Food grade diatomaceous earth is another effective treatment to get rid of fungus gnats. ... But if you mix some into the top layer of infested soil—or better yet, into your potting mix before planting—it will kill any gnat larvae (and adults) that come in contact with it, as if they were...