I put a layer of cheap aquarium gravel around my house plants. That's one way of controlling the fungus gnats which like to dig into the soil to lay their eggs. I completely cover the exposed soil with less than a quarter inch of gravel. That's enough to prevent them from penetrating the soil.
Fungus gnats (aka soil gnats) don't hurt the plants but an infestation can be really annoying to humans. They are the most active in the fall and winter months.