Because fungus gnats thrive in moist conditions, especially where there is an abundance of decaying vegetation and fungi, avoid overwatering and provide good drainage. Allow the surface of container soil to dry between waterings. Clean up standing water, and eliminate any plumbing or irrigation system leaks.