An invisible fence is a system to keep a dog inside a predefined boundary. When the dog gets too close to the edge of your yard, his collar will start to beep. If he keeps approaching, he will get a static-electricity shock or a spray of citronella in the face. Although both of these are unpleasant, they will not necessarily teach your dog the lesson, and might just confuse him. Without additional training, he may not realize that the unpleasant things that are happening to him have to do with him going too far.
Mark out the boundary of the invisible fence. You can use cones, flags, wooden stakes or similar markers. As long as the dog can see them easily and they match the boundaries of the invisible fence , they will work.
Teach your dog to come when called. This bit of training help you to teach him about the invisible fence. It will also make it easier for him to learn to observe the boundaries of the fence, since he will already have some experience with training.
Walk with your dog toward the invisible fence. As he gets close to it, his collar should start beeping. When it does, immediately move away from the fence and command him to follow you. When he does, praise him and give him a treat. Repeat this step for at least 15 minutes a day for a few days.
Keep your dog in the yard, on a leash that is just long enough to pass the perimeter of the invisible fence. Eventually, something will come along that he finds interesting, and he will try to bolt out of the yard. When he does, he will be sprayed and shocked and come running back (since there is nowhere else to go). Call him over to you and praise him when he comes.
Remove the markers slowly, taking out just one or two a day. Keep your dog on the long leash to stop him from running out into the street. As he gets used to the invisible fence, he will learn to recognize the boundaries without the markers. Once all of the markers are gone and he has stopped bolting into the street, you can let him play off-leash.