If you notice annoying little gnats flying around an indoor plant, the houseplant probably has fungus gnats. Overwatering your plants and not allowing the top part of the soil to dry out can be one cause. If your plants summered outside, the gnats may have hitched a ride indoors in the soil. After laying eggs in the soil the adults die out. The legless larvae feed on the soil's organic matter before maturing into flying gnats. Keeping the topsoil moist will help nurture the larvae.
Lay yellow sticky tape on the soil to trap the gnats, sticky side up. Cover as much of the surface as possible. The tape can be purchased at the gardening center. Throw the tape away after all the gnats are gone or on the tape. It should take one or two days. The goal is to first remove the gnats, and then kill the larvae.
Cut a potato into thin slices, about 1/4 inch thick. Do this as soon as you complete Step 1, before the larvae have a chance to mature.
Lay the potato slices on the soil. The larvae are attracted to the potato and will attach to the slice.
Remove the potato slices after four days and throw away.
Stick your finger into the soil, as far as you can. If the soil is completely dry, water the plant. You want the top soil to completely dry out between watering.