How often do you change the bedding? I can't say I've had an issue like this so I'll share my schedule with you, if it helps.
Every week I change the whole bedding. Regardless if a new litter is born or anything, I change it every Thursday or Friday. Beginning of each month the tubs are sprayed down with diluted bleach and rinsed out well before new bedding is put back in. When I change the tubs each week I wear gloves so I can really scrape off the corners where they urinate the most. It tends to stick to the pan.
My guess is the corners are really wet which is attracting the gnats. Or double check your water system, make sure it's not leaking. Even a few drips a minute can add up to a really moist substrate.
I change it every 2 weeks, but I'll try your schedule out. First time I have noticed so many flies and gnats though since I have been breeding. Thanks for the reply!