Their waste material, known as castings, helps in providing necessary nutrients to the plants. Also, because bacteria and fungi are one of their favorite delicacies, they help in pest control, as well. They also help reduce soil erosion by making the soil more fertile. So the more earthworms you have in your garden, the better it is for your plants.