Animal shelters are filled with dogs that "got out." You might think that no fences exist anywhere. But a dog with sufficient motivation and insufficient confinement can escape.
Often people seem to think that dogs "jump" fences, but that’s rarely the case. Usually, the dog has figured out how to climb out. I saw one dog that actually jumped up on a woodpile, climbed up on the roof of the house, and then jumped down onto a porch. The fence was perfectly intact and it took the owners a long time to figure out how the dog was getting out.
Dogs can sometimes use the fence itself to clamber up and over. I’ve seen video of an incredibly creative border collie climbing up and out of a chain link enclosure. There’s a reason that border collies win agility competitions. They’re agile.
Other dogs learn how to open a gate or systematically chew through a fence. Some dogs try combinations and spend a lot of mental energy determining their new exit route. Which brings up a good point: you should make an effort to figure out why your dog is so desperate to leave.
Dogs are pack animals and if they are spending hours and hours outside, they are probably bored and lonely. If that’s the case, you should spend more time exercising your dog. Walking the dog is good for you and the dog. Or you could consider getting him a canine buddy.
Dogs that haven’t been neutered also will try desperately to escape because they are seeking female dogs. This sex drive remains undaunted until you get the dog neutered. If you have a female dog, get her spayed because an unneutered dog will find her eventually.
Another reason a dog may be eager to leave is because he’s afraid of something. For example, if your dog is extremely afraid of loud noises and escapes every Wednesday right after the noisy garbage truck stops by, there’s a big clue.
Once you have decreased the motivation for escape, you can attend to the reality of your fence. If you have a "climber," you can add an extension to the fence that tilts in toward the yard.
If you have a "digger," try burying chicken wire below ground level or lay chain link fence on the ground. You also can lay patio blocks or other large bricks that the dog can’t dig up.
Whatever you do, don’t punish the dog after you’ve found him. Dogs live in the moment, so punishing him for something he did hours ago is pointless and just confuses him.