It's often possible to control gnats by getting rid of their preferred food and reproduction sites. Once you identify the type of gnats in your home, you can determine what's attracting them and take measures to get rid of the pests. A gnat problem can become a major nuisance. In the case of a severe infestation, you may require the services of a pest control professional.
Know Your Enemy
Gnats include three common pests, each with its own habits and attractions. Little black flies on and near houseplants are fungus gnats. A good way to prevent and discourage them is to avoid overwatering indoor plants and maintain them well. Small light brown flies hovering near vegetables or a fruit bowl and congregating in the kitchen are fruit flies. Little brown or black flies that walk in zigzag or erratic patterns are phorid flies. If you see phorid flies, check for a sewer line leak or septic tank problem, as that's what attracts them.
Keep Them Out
No matter what kind of gnats you have, one of your first lines of defense is excluding them from the house. Caulk any cracks in window and door frames, add or repair window and door screens, and use only pasteurized or sterilized soil for houseplants. Outside, use tight-fitting lids on garbage cans and locate them away from doors and windows. Discourage fruit flies by picking ripe fruit and vegetables promptly, and bury, compost or discard overripe garden produce regularly. Locate compost away from the house and keep it sealed.
Cut Their Food Supply
Put away the produce that attracts fruit flies. If you like your fruit room temperature, keep it in a pantry or cabinet instead of on a counter. Keep produce scraps in a fully closed container, such as a bin under the sink with a tight-fitting lid. Waste baskets with swing tops offer easy access for fruit flies, and peelings or overripe fruit in the trash attract them. Keep houseplants tidy by removing fallen leaves and flower petals so immature fungus gnats have nothing to feed on.
Get Rid of Their Larvae
Fungus gnats spend most of their lifespan in the larval and pupal stages. They grow to maturity in plant soil and the organic debris on the soil's surface. Getting rid of the immature gnats before they start flying is the most effective form of control. Remove the top 2 inches of soil from all the houseplants and get rid of it. Replace it with sand, which doesn't have any organic matter for the young to feed on, Fine Gardening advises. Stop watering the plants until the soil is entirely dry. This will kill any remaining fungus gnat larvae. Get rid of fruit fly larvae by disposing of all ripe fruits and vegetables that have been out in the open.
Bring on the Artillary
Insecticides aren't advised for fungus gnat control indoors or near the home, according to the University of California, Davis, Integrated Pest Management Program. Biological controls such as Bacillus thuringiensis subspecies israelensis can be effective. BTi kills fly larvae in container soil, including mosquito and black fly as well as gnats. Garden centers sell it. Choose a product labeled for flies; the ones for caterpillars don't work on gnats. Sticky strips available from garden centers will trap flying adults of all kinds of gnats.