Chances are high that if you have a fungus gnat problem, your soil mix is being kept too moist. Putting sand on the top will kill the gnats by suffocating them, but if your soil mix is too moist you'll probably also put your roots in danger.
I would recommend a neem oil drench. People have used sand how you're suggesting, but I don't have any experience with it. From what I've heard you need to water, then put the sand over the top, and then remove the sand when you want to water again. Otherwise trying to water through the sand will just result in a slurry throughout the soil as the water mixes it up.
You might also just try a different brand of soil. I was using Black Magic Natural and Organic for a while but no matter what I'd do, it always ended up getting fungus gnats. I'm pretty sure it was being sold with the larvae or eggs in the bag and then they were hatching later on.
I ordered and received an envelope of "gnatrol" powder which is a natural stomach bug found in dead gnats. Mix it in with your next watering. That takes care of the little buggers as they hatch. Then use strips of yellow tanglefoot to catch adults. I also mix cinnamon and water to spray the plants. It makes them smell nice and deters the gnats.
Just an FYI. I bought the yellow stickies and bought white ones because they're way cheaper. The white ones caught just as many if not more.
I had them in my last soil grow. I watered with neem oil. Then later laid stickies flat across the pot. I had some vertical too but caught way more on the flat ones. Good luck. Oh one more thing. I set off foggers. I did get them under control.
I don't know everything. My opinion is just that. It's up to you to research the information offered by me or anyone else. It's not wise to act on the first opinion you get.