Well, I certainly could be entirely wrong, but I've never heard of fungus gnats being a problem outdoors, only in greenhouses and indoor container-grown plants. So, are we talking about an in-ground garden, or container plants in a greenhouse or in your home? Fungus gnats are usually quite noticeable in any indoor setting.
The larvae cannot live in dry soil. They just shrivel up and die without sufficient moisture. They don't live very deep in the soil, mostly just in the top couple of inches. If you allow that much to dry, you should be able to get rid of them ...
if they are the larvae of fungus gnats. Some people say they are able to control fungus gnats by adding cinnamon and/or chamomile to the water used on the plants. You might be able to control the larvae by using a neem oil solution as a soil drench, although I'm not sure whether that would also damage helpful soil dwellers, such as earthworms.
There are similar flies & gnats that live outdoors in very moist soil. There are some kind of gnats that live in the soil around my birdbath, which is always damp because I dump and clean the birdbath almost every day. I don't bother them, because the birds seem to enjoy eating them. They produce clouds of some kind of little fly-like things in May or June each year, but the swarms tend to hover in the shade, by the birdbath, and don't bother me. They don't seem to be a problem for any of the plants growing in that area, either. But, that's just my own experience with gnats outdoors. I haven't had a problem with them indoors, but I'm careful not to overwater my plants. I practice benign neglect.
Since you're in California, you may find some useful information in this material from UCDavis:
https://www.ipm.ucdavis.edu/PMG/PESTNOTES/pn7448.html
"Isn't it enough to see that a garden is beautiful without having to believe that there are fairies at the bottom of it too?" - Douglas Adams