If your dog has started running away from you, or away from home, he is in danger of several hazards. Your dog can easily run so far that he gets lost and can't find his way home, he can run out into traffic and become an accident victim, he can run afoul of another dog's territory and be attacked, or in a rural setting, he may be attacked by wild or feral animals. Coyotes especially are known for attacking dogs that have strayed too far from their owners or homes. Curbing running behavior and teaching your dog to stay home, or with you, is an important skill to keep your dog safe.
Some dogs are especially prone to running. There are several reasons for a dog's running behavior; they may be scared, excited, or they may have learned to run after prey or to explore their environment. These are natural instinctive behaviors for a dog, and, with the exception of being scared, it’s fun for your dog--a reward in itself. Training your dog not to run will need to address the natural reward he gets from the behavior, and counteract it. It can be difficult and take some time to eliminate this behavior, especially once it has developed, however, it is critical to overcome your dog's tendency to run--for his own safety. Preventing the behavior from developing in the first place, by training your young dog to respond to your verbal commands, keeping him in an enclosed area, or on a leash, will prevent the self-rewarding running behavior from occurring in the first place. Ensure enclosures such as fenced yards are secure, gates are closed, and that your dog cannot jump the fence, or dig under the fence to escape. Some dogs have a tendency to go for the door or gate every time it opens, escaping if they can. Training to teach your dog that you own the door will curb this door bolting behavior.
You will need to spend some time teaching your dog commands to control him, both on-leash and off. This will require a time investment and lots of treats, praise, and rewards. You can also teach your dog not to bolt for an open door or gate, and it may be useful to engage an assistant to help you with this. Using a long leash during training is helpful to simulate your dog being off leash, while still retaining the ability to restrain him and prevent him from running. In extreme circumstances, where the dog is repeatedly in danger, the use or a whistle and shock collar may be necessary to prevent the dog from running and putting himself in harm's way.