Although nothing will stop a dog if it is intent on crossing a road, the one thing we teach all newcomers to training is the 'rapid' down. Teach your dog to lie down and then during heelwork give him a 'down' command in a very sharp voice, accept no dilly dallying, no second command, enforce the down by using the hand on the back of the neck or by drawing the dog down with the lead. Gradually use the command if the dog is off the lead and if you have taught it properly he will drop wherever he is.
If your dog learns no other command this is the one that may save its life, as said above if the dog finds itself on the opposite side of the road you don't want it to come to you, you want it to stay where it is, and the down command (which at that point will be shouted in a manic tone!) may just do the trick. Of course this will only work for you if you happen to see the dog go towards the road, but it is a very useful thing to teach. We also teach a drop on recall, so the dog starts to come towards you and then you give it the down command, so it drops where it is and then you can either recall the dog to you or return to the dog and praise.
Hence the car sticker 'dog trainers drop them anywhere'!