While rare in urban gardens, snakes are actually a very good sign to see and indicator of a healthy ecosystem. Being predators and carnivores, they like to feast on common garden pests including slugs, insects, and invertebrates. You don’t have to worry about them eating any of your prized tomato plants or other vegetables.
Snakes are cold blooded, and in our climate are typically most active at night. Like many animals, they are usually afraid of things bigger than they are. That means for the urban gardener, many of the snakes you may see which are generally smaller in size, will be going after relatively small pests and probably won’t be eating larger pests like mice and rats.
For those who are afraid of snakes and want to keep them away from their garden, limit potential habitats they could find appealing like tall grasses, thick mulches, as well as moist and shady areas. Be more careful when going through your garden at night, and remember that snakes are part of a healthy ecosystem and an abundance of life in the garden generally means an abundance of healthy plants.
For a list of Ontario snakes, Ontario Nature has a good guide on individual snakes, their habitats and biology.