Standing water and slimy residues cause drain fly infestations. Susceptible areas include basement floor drains and sink, shower/tub or toilet drains that are not used regularly, according to the University of California Integrated Pest Management Program. The larvae require moisture to thrive.
Drain flies inhabit any place that remains wet and mostly undisturbed for a week or more at a time. This includes water trays for plants. Septic tanks are especially favorable for drain flies, if not cleaned out regularly and inspected for leaks. Clogged gutters and any pools of water caused by air conditioners invite infestations as well.