My uncles swears by this but may not be good for your dog. Sprinkle cayenne pepper around the perimeter of your yard. Snakes smell with their tongue he says. They stick their tongue out and get a dab of pepper and go away quick. He says it works on copperheads which are pit vipers like rattlesnakes but who knows.

15 Steps To Keep Snakes Off Your Property