At present, research has not identified an effective, long-duration chemical repellent for snakes. Several snake repellents are sold in retail outlets. You might try one to see how effective it will be under your lawn conditions, although research indicating their effectiveness is not available. Additionally, repellents have to be reapplied, even if they eventually are demonstrated to be effective.
A better technique is to provide an environment that is less attractive to snakes. Snakes enter the yard to find food or shelter. A snake’s body temperature is dependent on the environmental temperature. It must seek shady, cooler areas in the summer to prevent overheating. Snakes are also more susceptible to attack from predators (hawks, domestic cats) in an open area. Removing piles of debris, keeping grass mowed regularly, avoiding leaning large objects against the home, and generally providing for more open space in the lawn make it less attractive to snakes. Snakes are more active during daylight in the spring and fall. The temperature is not so hot. Be more aware of their presence during these seasons.
You can also install a drift fence around the perimeter of the area that you wish to protect. This will be a barrier to most snakes. It can be built 18-inches or higher and inserted in the soil at least 1 inch. Stake every few feet to keep it vertical.