Peppermint oil or "Dr Bronner's 18-in-1 Hemp Peppermint Pure-Castile soap". Use one Tablespoon/gallon with the soap. If use oil my guess is only a few drops.
I have heard neem oil, but this is much more natural in my head at least.
Then stop over-watering. Let pots dry ALMOST completely between waterings. The time depends on many factors but pot size is a big one. If you are in 2-3 gallon pots, in my experience, no need to water but every 3rd or 4th day. I here a alot of talk of every other day, maybe if the garden is hot, but for me I would be too wet. My plants grow the most on the day before watering, usually 3 days after last.
The gnat larvae will not survive in semi dry conditions in the top 1-2".
I have found that they may come in in the soil, I use FFOF which is unsterilized, but go away with nothing more than proper watering, and smashing a few here and there. One pest strip would eliminate that though!
They can definitely get out of hand, I did it growing sod in the window for the F'n cat, and really overwatered it they were everywhere! The cat really liked chasing them as much as the grass itself...no more indoor yard!