Someone told me that putting 1 inch of play snd on top of soil is good for keeping fungus gnats out. I bought a bag and that stuff is so fine I an afraid of locking out any air exchabge with the soil.
I think I would try a piece of landscaping fabric. Water/air can move through it but the bugs should not be able to. I think it would serve the same purpose with less trouble.