Snakes can be attracted to your home for many reasons -- eliminate these reasons and they will be less likely to enter your living space. Food and shelter are what all animals seek, so if these can be minimized around your house and yard, there is a good chance the snake will move on to a place where it can find what it's looking for.
Fill all gaps, holes and spaces on the exterior of your house with expanding spray foam. Small openings around pipes are ideal for snakes to enter. Be sure they are filled from both the inside and the outside.
Remove any piles of wood, leaves and debris from the side of the house where snakes may be sheltering. Compost heaps should be kept well away from the house.
Tidy your outbuilding, garage and yard to eliminate any areas where snakes may find shelter.
Remove prey species like rats and mice from your home and yard. These are the biggest attractant for a snake.
Trim low twigs and branches of shrubs. If you can't see under it, a snake could be using it for shelter.
Cement rocks together that form a rockery. If there is no gap available, a snake won't linger.