Fungus gnats are small flies that thrive in moist soil, especially the soil in household potted plants. These flies actually do not fly well and tend not to venture far from their houseplant habitat. The larvae of the fungus gnat do the greatest damage. According to the University of California Integrated Pest Management (UC IPM) website, the larvae eat not only the rotting debris found in the soil, but also the roots of the plant. This can slow the plant's growth or even kill it.
Water your plant only as much as necessary. UC IPM recommends allowing the top layer of the soil to dry completely before the next watering. Do not over water your plant.
Remove all debris from the soil such as fallen flowers and dead leaves. This removes a food source for the gnats.
Do not use manure or other organic fertilizers or mulch in household plant pots. These attract fungus gnats.
Spray a non-toxic insecticide on the houseplant and soil to kill the adult gnats. You can make your own insecticide by mixing several drops of dish soap with a spray bottle full of water. Then lightly spray the plant.
Take the trash out regularly and do not allow fruit to rot inside the house. These are all places that fungus gnats breed, eventually moving to household plants.
Poke several small holes into a plastic bottle and fill it halfway with vinegar. Set this vinegar trap near infested houseplants. The adult gnats will become trapped in the bottle and you may then discard them.