If you can afford it, a small dehumidifier would do the trick. I keep this one in the piggy room which really helped keep humidity down, but there are cheaper options that I'm sure would work too.
I had this same issue. Small gnats were being attracted to the moisture (pee+poop) in the cage and to the evaporated water from pee making to room humid. Gnats LOVE humidity, so the solution was taking away the humidity.
I solved it by putting a dehumidifier in the room and haven't seen a single gnat in there since (6 months now). We bought this one but I think any one that functions will do.
I currently have this one