Summarize this article:

While it can be surprising to encounter a snake while weeding your garden or walking around your yard, having a snake around isn't necessarily a bad thing. In fact, you should be proud - a good snake population in an area is a sign that the ecosystem there is healthy. In addition, snakes play an important role in keeping other pests, like mice and rats, from taking over. So if a snake isn't eating your chicken's eggs or otherwise being a bother, consider sharing your yard with it instead of trapping it and moving it elsewhere.  Rat snakes and gopher snakes are especially beneficial to have around. They're as good as cats for keeping the rodent population down.  King snakes go one step further and eat rattlesnakes. In fact, if you get rid of a king snake, the rattlesnakes are more likely to move in - and then you'll have a much more serious problem on your hands. If you don't like snakes, a great way to keep them away is to make your yard less snake-friendly. Snakes hang out in areas that are a little unkempt and wild. They like tall grass, brush piles, wood piles, and other sources of shelter. To make your yard less inviting, do the following:  Mow the lawn regularly. Get rid of piles of rocks, leaves, brush, bricks, or anything else that a snake could use as shelter. Keep your rodent population down by cleaning up acorns, sealing your trash, and removing other sources of food for rodents. If you've been finding snakes in your attic or basement, look for cracks and holes that might be letting them in. Make sure the doors and windows are sealed around the edges. Screen the chimney, vents, and any other spots that could serve as an entryway for a snake. Snake experts seem to agree that most repellents aren't effective, but they might be worth a try if you've exhausted other ideas. Try putting one of the following substances in your garden, chicken coop or wherever you have a snake problem:  Spray a solution made with fox urine around the perimeter of your property. Some say that snakes are deterred by the smell of their predators' urine. You can find this solution in home and garden stores. Try putting rags soaked in ammonia around the yard. This substance is said to repel snakes and other animals. Put human hair clippings around your garden. The smell of the hair is said to keep snakes away.

Summary:
Consider letting nonvenomous snakes stick around. Make your yard less hospitable to snakes. Seal your house. Try snake repellent.