+1 for the invisible fence systems. We used to have a German Shepard and after several escapes and destruction of landscaping, we installed a system from Innotek. The training collar would beep as the dog approached the buried wire and only issued a shock if she continued to within a foot or so. I think it took about 3 hours and 2 corrections for the dog to understand her new boundaries.
I'm not sure about your specific situation, but one of the things the system allowed us to do was let our dog out in the front yard. She much preferred it as there wasn't much grass in the backyard due to the pool. We just ran the wire along the sidewalk and that kept her in her yard.
A couple things to keep in mind:
Make sure you are regularly checking the battery in the training collar. Our German Shepard would sometimes lay in the yard at the point where the collar started beeping. She knew that as long as it was beeping she should wouldn't receive a correction. What she didn't know was that the constant beeping would drain the battery. Once the battery was dead, the collar stopped beeping and after a few days she would realize that no beep=no shock and would sometimes push the boundaries. For the most part, once she learned the boundaries, she respected those lines with or without the collar.
These systems use a thin gauge wire that emits an EMF signal to create the barrier. That wire can be prone to breakage, especially if you put it along the edge of a lawn where it might get nicked by an edger or mower. Proper planning and installation are a must. Remember that the training aspect of these types of systems happens in the first few days after installation, but the training collar remains your last line of defense, so make sure it's always working.
Direct training with your dog is the most important thing. There are training aides and instructions with the kit, make sure you are working with your dog to establish those boundaries and using positive reinforcement when it respects those lines. The training collar is a deterrent, but you need to be showing your dog what you want it to do, not just reprimanding it for what you don't want to do.
When setting up your boundaries, be aware of any "traps" and adjust accordingly. Our system required the wire to run down the side yard from front to back. This didn't seem like an issue as the wire then continued along the edge of the pool patio, effectively keeping the dog out of the side yard. One day, we heard panicked barking coming from the backyard and found the dog stuck on the side yard. She had pushed past the barrier at the edge of the patio (remember, the collar is only a deterrent) and once she was down the side yard there was not enough space for her to get away from the wire that ran down the length of the house. As such, there was no way for her to get back to a "safe zone". Moving the wire up to the trim on the house about 8' off the ground prevented that from happening again.
There are other options besides electric shock, but each dog responds differently. We now have a Terrier mix who barks at any activity outside. I work from home and on days where I am here and need to make work calls, we use a citronella filled bark collar that sprays a fine mist in front of the dogs face when he barks. It has been sufficiently effective but seems to be less of a deterrent than the electric shock. I am always a proponent of positive reenforcement training and using the gentlest correction possible. But be aware that depending on your dog, you may have to adjust the method or strength of correction. We tried the citronella approach with the German Shepard and found that it was not enough to deter her.
Best of luck in whatever method you find works for you and your dog.