1. Keep soil dry: Fungus gnats seek out moist soil, so allowing your houseplants to dry out a bit between waterings can slow down or stop an infestation. Let the top inch or two of soil dry out before watering again, and try to go as long as possible between waterings. Gnats may be deterred from laying their eggs if the soil is dry on the surface.
2. Mosquito dunks (with beneficial bacteria): Mosquito dunks are used to keep mosquito larvae from populating fountains, animal troughs, fish ponds, and other small bodies of water. The product consists of a dry pellet containing a type of bacteria called Bacillus thuringiensis subspecies isrealensis. This beneficial bacteria infects and kills the larvae of flying insects, including mosquitoes, fruit flies, and fungus gnats.
To use mosquito dunks: Fill up a gallon jug (or watering can) with clean water and toss in a mosquito dunk. It’s a good idea to break up the dunk a bit before placing it in the water, or you can wait for it to soften before breaking it apart. Let the dunk soak in the water for as long as possible (at least overnight), then remove it from the water (the dunk can be reused) and use this water for fungus gnat–infested plants. The bacteria will have leeched into the water and will now infect and kill any larvae that come into contact with it in the soil. Repeat this process every time you water your plants for at least a few months.
3. Cover drainage holes: Though gnats typically remain near the tops of pots, they may find their way to the drainage holes on the underside of a pot and start laying eggs there, too. If this happens, cover the drainage holes with a piece of synthetic fabric to prevent the gnats from getting in or out of the hole, but to also let water pass through freely. Attach with tape or rubber bands.