Remove all dead leaves and other detritus from your houseplant's soil and surroundings to deny fungus gnat larvae food and shelter. Only water your plants when the top inch of their soil is completely dry. Moist compost is an ideal medium for fungus gnat larvae.
Trap adult fungus gnats and whiteflies with commercially available sticky traps made from bright yellow card. You can trap whiteflies with homemade traps made of yellow card covered with petroleum jelly or mineral oil, according to Bruce A. Barrett, Division of Plant Sciences professor, University of Missouri.
Spray adult flies with a pyrethroid-based insecticide based on bifenthrin or permethrin. Apply insecticidal sprays to plants infested with whitefly at five- to seven-day intervals. Insecticide resistance means you may have to spray five times to kill them all.
Use a soil drench based on the systemic insecticide imidacloprid to kill fungus gnat larvae before they hatch into adults. An imidacloprid-based soil drench is also effective against whitefly larvae. Alternatively, use a biological soil drench containing the microbe Bacillus thuringiensis var. israelensis or the nematode species Steinernema feltiae. Whiteflies are vulnerable to the commercially available parasitic wasps Encarsia formosa and E. californicus.