Summary: A subtly dangerous pest that can attack your plants, causing serious, permanent damage with few external symptoms!
Scientific name: Bradysia coprophila (family Sciaridae, order Diptera)
Size: 3-4mm (1/8")
Description: Slender, grey or black body; one pair of clear, unveined wings. Long legs and a tendency to fly aimlessly around, alighting occasionally on the leaves of plants.
Like many insects, fungus gnats develop through metamorphosis. They start out as larvae in the top layers of soil, develop into pupae and thence into the winged, flying adult. Total developmental time to adulthood is 2-4 weeks. During the larval stage they feed on fungi in the soil as well as decaying organic matter and plant roots. Once they reach adulthood, fungus gnats typically last just long enough to seed a new generation of larvae.
Why should I care?
These little suckers are not your friends. If you grow houseplants or any kind of potted plant, fungus gnats can become a major problem very quickly. This is because the larvae, when they run out of fungus in the soil, will start to nibble at your plants' roots! While it would take a very large developing population of gnat larvae to completely destroy a plant in this way, the gnats' feasting can seriously stunt your plant's growth, causing discoloration in the foliage and malformed branches and limbs. The larvae may also aid in the spread of plant diseases with scary-sounding names, such as: Pythium, Verticillium, Cylindrocladium, and Scelerotinia.
Fungus gnats are particularly troublesome because the larvae prefer an organic growth medium. They can actually cause more harm to potted plants grown in sterilized potting soil than to plants grown in the ground! They also thrive in moist environments, meaning that overwatered houseplants are a prime breeding ground.
Marijuana cultivators particularly need to be on the lookout for fungus gnats, as the larvae, in addition to attacking the roots of your precious ganja plants, will leave behind casings that quickly ruin the drainage properties of your soil. Cannabis requires good drainage and a steady but small supply of water, so an overwatered marijuana plant that falls victim to a fungus gnat colony has two strikes against it. If an infestation occurs during the flowering stage of the plant's growth, it could seriously reduce yield.
How do I detect them?
Like most tiny flying critters, fungus gnats have an irrational attraction to the color yellow. Purchase some yellow sticky cards from a garden center; yellow sticky tape works equally well. Place the sticky cards near your plants for a few days and observe what gets caught on it. If you see more than a few gnats, there are most likely larvae in your soil.
Once you've spotted a likely infestation, cut a slice of potato of about one square inch, and 1/4 to 1/2 inch thick. Place it on the soil in your plant's pot and wait 4-8 hours. Fungus gnat larvae really love a good snack of potato. Remove the potato and count the number of larvae that have moved onto it; this will give you a good idea of how big an infestation you're dealing with.
How do I get rid of them?
Getting rid of the adults is a snap: simply give them a sticky yellow surface to land on, and within a few days you'll have enough dead adults to make a tasty dinner of gnat casserole (YMMV). The larvae are a bit trickier. The first step toward getting rid of them is to starve your plant of water for a few days, letting the top layers of soil dry completely. Larvae cannot develop in dry soil, though they can survive a drought by suspending their development. Don't worry about killing your plant; it takes serious dedication to kill most houseplants from underwatering, while overwatering a plant can kill it very quickly.
Once the soil is dry, mix 1 part hydrogen peroxide (H2O2) solution with 4 parts water. Use 3% solution, which you can find in any drug store or in the hygiene/medicine aisle of a chain grocery store. You can use a stronger solution if you change the water mixture appropriately, and don't be too concerned with proportions; it would take a very high concentration of H2O2 to hurt your plants. Just make sure you buy pure H2O2 with no chemical additives! Hydrogen peroxide is often sold as a topical disinfectant, and things that are good for your wounds may not be so healthy for your plants.
Water your plants as you normally would, using the hydrogen peroxide solution and taking care to get good coverage of the entire top layer of soil. Use a spray bottle if desired. The soil will fizz for a few minutes after application; this is natural. The gnat larvae die on contact with the H2O2. After a few minutes the fizzing stops and the H2O2 breaks down into oxygen molecules (which your plants don't mind) and water molecules (which your plants love).
Congratulations! You've just successfully treated your fungus gnat infestation. Monitor the gnat population for a few days with sticky cards, in order to make sure you've got them all. Make sure not to overwater, and consider sometimes adding a little hydrogen peroxide to your daily waterings--in my experience, the plants react well to this little treat. Watch your plants grow big and strong and enjoy the fruits of your labors, whether they be flowers, vegetables, literal fruits, or big sticky nugs of homegrown chronic.
Primary source for scientific stuff: http://insects.tamu.edu/extension/bulletins/uc/uc-028.html