Neem oil it kills gnats in the larval stage as well as the adult gnats. Spray new plants as soon as you bring them home as well as when you repot plants.
Cinnamon is a powerful natural fungicide and a natural gnat repellent that kills the gnats' food source. Just sprinkle some on top of your soil!
Add hydrogen peroxide to your weekly watering routine to get rid of gnats. You'll want a solution of one part hydrogen peroxide to four parts water.
If I discover gnats in my plants the very first thing I do is put in yellow sticky fly traps to catch the adult gnats!