More than once have I gone to water my houseplants, only to be met with swarms of tiny gnats flying up out of the pots. While (mostly) harmless, fungus gnats will make themselves at home in your soil and multiply quickly, making an infestation difficult to squash. The larvae will also feed off roots and siphon away nutrients, leaving less available for your plants. If you notice sudden wilting, yellowing, or slowed growth, fungus gnats may be responsible.
Ridding your home of fungus gnats requires healthy doses of both prevention and treatment.
Fungus gnats love the organic matter in moist, nutrient-rich soil, and they can infest bags of potting mix before you even bring them home. Take care not to purchase bags that have any holes or tears, and inspect soil before repotting plants to spot any white, glossy larvae or adult flying gnats that may have laid eggs.
You should also research the best soil type for your specific plants or garden projects. In general, look for well-draining potting mix for your indoor houseplants, which can help reduce soggy environments that attract fungus gnats.
Fungus gnats can also take up residence in plants at your local garden store, so don't bring anything into your home without checking for an infestation. Give pots a tap, which should disturb gnats enough to send them flying, or inspect the soil directly. You can also quarantine new plants—and any plants that have been outside for extended periods—and treat them before placing them near any of your existing plants.
Again, gnats love moist soil, so take care not to create an environment where they can thrive. Ensure good drainage in your soil and pots, and let the top one to two inches of soil dry out between waterings (or consider submerging your plants for watering instead). If you are on a rigid watering schedule, switch to checking soil moisture or using a moisture meter so you don't overdo it.
Good air circulation—accomplished by opening windows or running a fan at a low speed—can also cut the excess humidity that gnats love.
Once a gnat infestation has begun, you'll need to deal with the population of adult flyers. Your best bet is to purchase yellow sticky traps, which are available at garden centers or online, to stick in your soil. The gnats are attracted to the color but get stuck once they land on the trap. You'll probably need to replace the traps a few times until the population declines.
Finally, if the infestation is stubborn, consider an insecticide treatment (as you'll keep getting adult gnats if you don't eliminate the eggs and larvae in your soil). Some indoor plant pests can be treated with neem oil, but a more effective option is mosquito bits that contain BTI bacteria, which kills gnat larvae upon ingestion. Again, it may take some time and a few applications to completely eliminate your problem.