Fungus gnats larvae live in the top inch or so of very damp soils. The easiest recommended control for house plant infestations is to allow the top few inches of the soil to dry out completely between waterings. This is not advisable for carnivorous plants. Another preventative is to put a top mulch of sand at least 1/4 inch thick. The adults are not able to lay their eggs through this layer or are fooled into thinking the soil is too dry for them. The mulch should be applied before an infestation begins.
I've tested this method in my Sarracenia rosea pot and it works quite well. The added plus (or perhaps a minus) is that none of the other mosses grow in the pot either.
Read more about fungus gnats here:
http://www.ipm.ucdavis.edu/PMG/PESTNOTES/pn7448.html
http://www.ipm.ucdavis.edu/PMG/r280300811.html
And for those who think the larvae are harmless (from above):
Only fungus gnats commonly damage plants. Larvae of these flies feed on roots, thus stunting plant growth. Root damage can occur in interior plantscapes and in houseplants if high populations infest moist, organic-rich soil. Fungus gnat larval damage can be especially serious in greenhouses, nurseries, and sod farms. In addition to larvae chewing on roots, both larvae and adults can spread plant pathogens and may promote disease in commercial crops.
and
DESCRIPTION OF THE PESTS
Fungus gnats are small (2–5 mm long) mosquitolike flies with dark wings, delicate legs, and long antennae. They lay their eggs in soil, and the eggs hatch about 4 days later. There are four larval instars that increase in size up to about 0.33 inch (8 mm). Larvae are clear, with visible internal organs, and have shiny black head capsules. Initially larvae feed on root hairs and algae; later, larvae may feed on the insides of roots. When populations are high, larvae may bore into larger roots or stems that are in the soil. Larvae will also feed on leaves touching the soil. One generation may complete development in 21 (72°F) to 40 (61°F) days.
DAMAGE
Larvae usually feed on roots and algae within 1 inch of the soil surface. Root feeding by larvae can allow entry of plant pathogens. Direct damage through root feeding can cause wilting even though the plants are being sufficiently watered. Damage is particularly severe in propagation areas, in seedling flats, and with especially sensitive crops. Adult fungus gnats also disseminate soil-inhabiting pathogens on their bodies and in their feces. Fungus gnat adults can be a nuisance when present in large numbers.
Fungus gnats are a vector in spreading the Fusarium fungus which is responsible for rhizome rot in Sarracenia.