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.

...
Snakes can fit through very small openings looking for shelter.
...
Expanded foam fills gaps completely and can be trimmed once dry.

Step 1

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.

...
Wood piles offer the perfect shelter for snakes.

Step 2

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.

...
A tidy garage has less places for a snake to seek shelter.

Step 3

Tidy your outbuilding, garage and yard to eliminate any areas where snakes may find shelter.

...
Rats and mice attract snakes.

Step 4

Remove prey species like rats and mice from your home and yard. These are the biggest attractant for a snake.

...
Trimmed bushes offer less shelter to snakes.

Step 5

Trim low twigs and branches of shrubs. If you can't see under it, a snake could be using it for shelter.

...
Snakes love water. Removing gaps between rocks can stop them staying.

Step 6

Cement rocks together that form a rockery. If there is no gap available, a snake won't linger.