Here are some strategies for keeping gnats out and worms in. Place yellow sticky traps horizontally on the soil surface. They might not be pretty, but they allow you to kill some adult gnats and monitor their populations. If numbers are high, apply beneficial nematodes (Steinernema feltiae or S. carpocapsae) that will attack the larvae. These nematodes are sold commercially under the names Scanmask and Nemasys. Follow the application instructions on the package. Oddly enough, your worms might even aid the fight against gnats. "Earthworms have been shown to increase the dispersal of Steinernema in some cases," says Dr. Bohlen.
Finally, there's always repotting your plants in sterile soil with less organic matter. Of course, that means bye-bye worms; you'll have to relocate them.
photo: (cc) EBKauai/flickr