I used an invisible fence, Radio Fence brand, a few years back when we lived on 18 acres 8 in St. Louis county in Missouri, with our "yard" area an acre or 2. We had one dog that wandered off and got hit by a car, and I vowed we would not get another dog until we had a fence. It worked great. We had a Lab mix, big dog. About 2/3s of our lot was wooded, and the neighbors on one side had horses, and the deer would cross the yard to drink at the pond, lick salt and share the horses feed, and a neighbor on the other side fed the wild turkeys, so they crossed from the woods behind us to her twice a day. Then we also had an assortment of squirrels, fox, raccoons, coyotes, possums, and rabbits. The dog never chased any of them over the fence. The only thing he would cross the fence for was to follow our kids. You could see him working up the nerve to do it. He knew it was going to hurt, he knew it would hurt when he came back, and you could see him screwing himself up for the shock. He wouldn't do it for anything else. We did have to keep an eye on the battery, because he knew when the collar didn't give him the audible warning, it also wouldn't shock him. If you have a very obstinate big dog, they do make special collars for them. We installed a playground across from our driveway while I was there and the guys working on it were amazed that the dog would just sit across the driveway watching them, but would not cross the fence, which of course they could not see.
Just a few weeks ago I installed it in our current yard. Not nearly as much yard. We now have a full blood black Lab, a very big black Lab. Took him no time at all to figure out the fence. Not that he figured out a way to defeat it, just figured out that he didn't want to cross it. Except, once again, this dog will cross it to follow my son. He had been starting to wander, and I have not noticed him doing so since we installed it. It did take him a few days to want to go back outside. Until the dog figures out just where the fence is, and how to not get shocked, they can be a little wary of going outside period. At the other house our dog refused to go out after we had been using it for a time, and in investigating I found that evidently someone had turned the adjusting knob up all the way and the dog was pretty much getting shocked as soon as he stepped out the door.
A new development that I would have been interested in when we were on the large lot is a wireless invisible fence system. The radio signal goes out from a central location. In the right situation it would be the simplest system to install. Radio Fence also now recommends that instead of burying the wire, you can put the wire on the surface, held down with staples. The grass is supposed to cover the wire as it grows. I buried the wire last time, and tried the surface installation this time. So far, so good, but I'm still waiting to see how it works in the long run.