Diatomaceous earth is a natural powder made from fossilized diatoms that can help control fungus gnats. Sprinkle a thin layer of diatomaceous earth on the surface of the soil. When the gnats come into contact with the powder, it absorbs the moisture from their bodies, leading to dehydration and death.