Some ways to control indoor gnats include placing sand on moist soil, creating vinegar traps, using potato slices to attract the larvae, using sticky traps, and using food-grade diatomaceous earth. Biological controls include using hydrogen peroxide, cinnamon, chamomile tea, Bacillus thuringiensis and beneficial nematodes.
Placing a half-inch layer of sand over moist soil tricks the gnats into thinking the soil is dry because the water drains past the depth at which the adults lay their eggs. A vinegar trap consists of filling half a baby food jar with apple cider vinegar and a couple of drops of dish soap, then adding the lid and making holes big enough for the gnats to enter. Placing 1-inch by 1-inch by 1/4-inch pieces of potato slices on the surface attracts the gnat larvae. Repeatedly replacing the potato slices each day eliminates the gnat population. A sticky trap is a bright yellow card stock with Vaseline on its surface that traps gnats on contact when placed above an area that gnats inhabit.
Food-grade diatomaceous earth consists of microscopic shards of silica that injure any insects that crawl through them. A mixture of water and hydrogen peroxide sprayed over the dried-out top layer of the soil kills gnat larvae on contact. Cinnamon powder destroys the fungus that is the gnat larvaes food source. Bacillus thuringiensis, with the specific strain israelensis, is a bacteria that kills fungus gnat larvae.