Summarize this article:

Many dogs run away because they think they need to get home. If you’ve moved recently, your dog may not understand that your new home is his new home. Whenever your dog will be spending time in a new place, give him time to explore and become familiar with the smells and sounds. A common reason dogs run off is to find a mate. This is especially true of unneutered male dogs. Having your pet spayed or neutered will help prevent this urge. Spaying and neutering also helps prevent unwanted puppies from becoming strays and crowding shelters. Dogs are social animals. They need stimulation and interaction or they’ll become bored. Make sure your dog has plenty of social time with you, other dogs, or other people.  If you work long hours, consider hiring a dog walker or pet sitter to engage your dog during the day. Not all dogs will get along with others. Always introduce dogs while they’re on a leash to prevent dangerous fighting. Sometimes, dogs run off simply because they want to run. Make sure your dog gets plenty of walks and time outside. This way, he won’t need to run away just to get exercise.  Different breeds need different amounts of exercise. For example, a pug may only be able to walk briskly for 20 or 30 minutes before needing a break. A husky is bred to run great distances. Find out what’s healthy for your particular breed. Exercise can include going for walks, chasing a ball or a frisbee, or running around a dog park with other dogs. Make sure your dog knows that coming back is good behavior. When he comes back, praise him and give him a treat. This reward will teach him that coming back can feel as good as running away.  Never scold a dog when he returns to you, even if it took him a long time. This teaches the dog that he’ll be punished for coming back. Don’t only call him back when the fun is over. For example, if you’re at the park, call him back for a moment before letting him continue to play. If you always call him right before going home, he’ll learn that coming back means that playtime is over.

Summary:
Make sure your dog’s environment is familiar. Get your dog spayed or neutered. Give your dog plenty of interaction. Give your dog plenty of exercise. Reward your dog coming back to you.