Drain flies live in the pipes of your bathroom feeding off the organic matter.
"You're likely to spot drain flies near sinks and showers that are stagnant for a time (like after a long vacation) or used very infrequently (such as a guest bathroom),” according to Apartment Therapy.
How to get rid of drain flies
First, discover where the flies are coming in. It’s also a good idea to make sure the source isn’t rotting fruit or something else. Next, cover the drain with masking tape or a plug to stop more flies from coming into the house.
To get rid of the flies that have already made their way inside fill a bowl equal parts sugar, water and white vinegar. Add a few drops of dish soap and leave next to the entry point.
As for the flies in the drain, Apartment Therapy recommends pouring boiling water down the drain and recovering it. Repeat this process until the flies have vacated your pipes.