Driveways that are filled with gravel need to be flat, well graded, and paid attention to over time. The more frequently the gravel driveway gets used though, whether it's from animals, people, or vehicles, the more the gravel is going to shift and spread. With some careful forethought though, it can be fairly easy to maintain a gravel driveway, and to keep the gravel in its proper place.
One easy way to keep the gravel in a gravel driveway is to make sure that there is a decent depth of gravel. While the gravel is loose stone, if there are three inches or so of it, then the gravel will begin to compact itself. The weight of the gravel on top will press down, pushing the lower levels of gravel into the dirt and making a more solid base. The more weight there is (up to a point) then the more solid a gravel driveway is going to be overall. However, care should also be taken not to put too much gravel into a driveway, because then there is so much stone that it will rattle around and spread out, widening the driveway unintentionally.
Another way to keep gravel in place on a driveway is to put down borders. These borders could be a wooden fence, railroad ties, or even brick pavers. What materials are used to make the border are up to the homeowner and their sensibilities. All that is necessary is that the borders are strong enough to stop the driveway from shifting outward. This method is especially useful for driveways that are straight and easily framed. Curving driveways can be more problematic, but this method can still work, provided that you have flexible enough border material.
Tamping and Packing
For those who aren't averse to doing some work every now and again, maintaining a gravel driveway by hand is also an option. Gravel should be raked up onto the driveway, and tamped down until it's flat. Then the gravel should be wetted down with a hose, allowing the rock to shift and the dirt to accept the gravel once again. Don't use too much water, because you might cause the driveway to shift and the dirt to run. This will end up doing more harm than good, and it will require you to start the project all over again.