Persistence man.
You have to affect their ability to reproduce. Also, any other part of you house has fungus gnats flying around like your sink, your garbage cans or you clothes piles, then you need to get rid of those too.
Keep the grow room clean of dead leaves and any standing water puddles, big or tiny. Keep a thick layer of soil above the root ball. At least 2 1/2 inches. If you can easily swipe away the soil on top of the pot, and see the roots, then you'll have more bugs. cause they feed on those top roots. Sand is a band-aid and it really messy onces it comes time to water. Plus, imo, it affect the gas exchange between the soil and the atmosphere, but Idk for sure. It just seems like the sand lets less air pass through than than normal when watering but that's just my opinion. If you mix your own soil, add Diatomacious Earth to it as it controls bug and larva in the soil.
Try getting yourself a herbicide. I use Ed Rosenthal's Zero Tolerance. It's made with essential oils of cloves, cinnamon, rosemary and some other stuff. This stuff kills gnats on contact. It's awesome. Use it to spray the top of the soil in the pots or wherever they're congregating to kill them in mass quantity. The ones that fly are the only one that reproduce, so one you reduce their number, controlling the population is a lot easier. Kill the flying ones first...
I also use potato slices. If you put raw slices of potatoes on the topsoil, the gnats lay their eggs there, and you just throw them out at the end of each day.
You do enough of that stuff, and I'm sure you'll see less and less gnats. Oh, yellow sticky traps also help, but they're annoying.
Caution, this is the gentle way of 'controlling' the fungus gnats. The herbicide and potatoes do nothing to harm the plant or stress it out too much if at all. If you're garden is really big or the infestation is out of control (or if you're just plain sick to death of them), then you might have to looking into more aggressive techniques. Soil drenches w/Larvaecides like BT kills pretty effectively. but larvae is really hard to kill. I believe poisons strong enough to kill larvae probably aren't great for plants. That the plants don't like it, so to speak, but there are a lot of people who disagree and use BT anyways with no serious (seemingly...) problems.
There's also pyrethrin. It's very good but expensive. Azadirachtin (Azamax) is really good stuff too, but is also expensive.