Many states have laws that make it illegal to walk a dog without a leash -- in place to protect other people and the dog. But responsible owners should teach their dogs how to walk politely beside them without even thinking of running, both on -- and off -- the leash.
Establish yourself as the alpha leader before you ever think of letting him off that leash in an area that is not fenced. Your dog should know that you -- and any other human in the household -- are above him on the hierarchy, and therefore are to be obeyed at all times, including when he is not constrained. Take him to obedience classes or work with him at home to help establish your authority, if necessary.
Train your dog the "stay" command. Place your dog on a leash and walk with him on your left side. Stop walking and ask him to sit -- wait until he does so. Then place your hand in front of his nose and say "stay" in a firm voice. Move a foot or so away from your dog and wait up to 30 seconds; if he stays, reward him with a treat and praise, saying "good stay" several times. If he does move during the waiting time, push him back into place and say "stay" again in a firm voice. Repeat the exercise until your dog understands "stay" while on a leash. Then move to practicing this exercise off-leash in a fenced-in yard.
Make sure your dog knows his name and responds to it, as well. Practice this at home when he is in various stages of relaxation or play; call him, and then reward him with a treat or lavish praise when he responds to his name. Repeat this exercise, and add it to the "stay" exercise. This will help your dog associate the command with being directed at him.
Do not chase your dog at any time during his command training. This can encourage him to run if he is ever off-leash, thinking a game of tag will ensue. Do not scold him for running away during training; instead, praise him when he returns and continue working on the "stay" command.
Practice with your dog off his leash every day, and even use it as part of his play time. Practice in a quiet atmosphere, such as your backyard, where you are in control. When your dog can stay and respond to his name easily off-leash, try a fenced-in front yard, then a friend's yard, then a dog park. Each step up will give him additional stimulation that he can learn to shut out and ignore as he learns to remain beside you when he is not restrained.