Summarize this article in one sentence.
By keeping your yard engaging for your dog, you make it hard for him to want to leave in the first place.  By keeping your yard secure, you make it hard for him to leave even if he wants to.  Play with your dog often in your yard.  If your dog strays to the edges of the property, call them back.  By playing and learning the boundaries, he will be more inclined to stay close to home. Keep plenty of toys and play things in the yard.  If your dog is outside for a long time, add food and water to prevent escapes based on a search for these things. Make any fence tall enough so that it cannot be jumped over.  Also check that it runs deep enough so that your dog cannot dig underneath and escape. Work with your dog to teach them some basic commands.  The most useful commands you might want your dog to learn are “come” or “sit”.  This will allow you to have your dog return directly or at stop to sit, if he escapes. If your dog suffers from anxiety when you leave him alone, punishing your dog will not help him relax.  Try instead to help your dog overcome anxiety that is cause by your departure.  Punishing and anxious dog will only help to increase fear. Conversely, do not reassure your dog when it is exhibiting anxious behavior, as this will reinforce the anxiety. It is best to simply ignore any unwanted, anxious behavior from your dog. Once your dog is free of the fence, any punishment will become associated with wherever he might find himself at that moment.  Only discipline your dog if you catch them in the act of escape.    Punishing after escape will not teach your dog that escape itself is wrong. Disciplining your dog after you catch him will only make him fearful of you.  Catching him again will become more difficult as he may try to run away from you. If you are able to catch your dog as it tries to escape, you may take disciplinary action.  You will have to be careful to discipline him in a way that he will associate only with the escape, not with you.  Try taking and action that your dog won't associate with you. Spray your dog from a distance using super-soaker type water pistol so your dog won't see you coming. If your dog sees you as the cause behind the unpleasant disciplinary action, he will associate with you alone.  Now your dog will simply wait for you to leave before going back to his escape plans.

Summary:
Make your yard exciting. Teach your dog basic obedience. Don't punish fear or anxiety based escapes. Never discipline your dog after an escape. Catch your dog in the act.