you can look into an invisible fence. it works for some dogs but not others. Personally, my lab ignored it. Even with it turned to the max, he would just scream and yelp as he charged through, stop and shake it off, and continue on his merry way.
Instead, I would work on boundary training him. First step is that he isn't outside off-leash PERIOD. Set up training sessions where you walk the perimeter of where you want him to go and correct any time he starts to show interest in anything beyond that point. It's best to have a visible boundary, preferably several feet from the road. Farther is better. Once he is reliable on a short leash, go to a long line. Same thing again. Get with a trainer experienced in working with e-collars and have them teach you to use one and then work with that. It's a long process that takes several months.
And in that entire time, your dog can't be off-leash in the area. Even one time of running to the road teaches him that it's possible and sets back training.