One of the best all-around fixes for derailments, besides fixing tracks, is adding more weight to cars. For HO scale, the optimum weight of a car can be found by having 1/2 an ounce for each inch the car is long, plus one ounce. For instance, if your car is 6 inches long, it should weigh 3 + 1 ounces, or a total of 4 ounces. Remember, this is what the car should weight totally. To find out how much you need to add, subtract the current weight of the car.
When adding weight, it is useful to know that 12 pennies equals about one ounce. While pennies aren't the best source of weight, they are easily added. Remember to secure your weights with glue so they don't rattle around. Weights should be placed as close to the middle of a car as possible, and as low as possible.
Many modelers also find it useful to weight their locomotives. However, if you have bought a quality locomotive to begin with, it should weigh enough. If you find that your locomotive is slipping when going up grades, your might need to add some weight. It's also imperative that you don't run too many cars; that is- that you don't exceed the number of cars that your locomotive can successfully carry.
Many advanced modelers prefer to upgrade their couplers from the traditional plastic "horn-hook" type to better couplers called "knuckle couplers." They look more realistic and can be magnetically uncoupled hands-free from anywhere on the layout. Such couplers have magnetized pins that dangle beneath them and hover just above track level. Under the track around the layout, magnets can be placed. When a train stops over them, and then reverses, the cars are uncoupled. Many modelers also place electromagnets under their rails so that they don't have to stop and reverse to uncouple. It's also a common practice, especially with prototype railways, to build "hump yards." The uncouplers are built into a gentle slope so that the newly uncoupled cars roll slowly down the hill, away from the mainline.
When deciding if these couplers are right for you, remember that there is a significant cost involved, with each pair costing around two dollars. It's also imperative to consider the amount of time required to retrofit existing rolling stock with them. The couplers must ride at a specific height, which means that shims and "trims" must often be made. The magnetic pins as well must ride at specific heights as well. For installation, follow instructions that come with the couplers.