If you're battling drain flies, you know what an annoyance they can be. They usually come from floor drains, but can also find their way into other infrequently used drains.Fortunately, there are several effective ways of getting rid of drain flies.
Roto-Rooter, America's leading provider of plumbing & drain services, recommends the following methods of killing drain flies and their larvae.
First, pour 1/2 gallon of water through the drain. If the water drains away quickly, that means the drain is functioning properly. If possible, pour in a panful of very hot water to kill larvae. (Remember that boiling water can cause some surface materials to crack).
Next, pour in a cup of white vinegar. This should finish off the larve stuck to the inside of the pipe. Some people recommend bleach, but bleach is caustic and can be dangerous. If you use bleach, do not mix it with the vinegar or you'll create dangerous chlorine gas. Take the cap off the bleach bottle and pour bleach into the cap. Then pour the capful of bleach into the drain. That's more than enough bleach to kill insects and their larvae inside the pipe.
Besides white vinegar or bleach, several other household items can also kill drain flies. Just be careful not to mix any of these concoctions or you might endanger yourself. Pour in 1/2 cup of salt and 1/2 cup of baking soda plus a cup of white vinegar. Allow it to work its magic overnight then flush the drain with hot or boiling water the next morning. This will sanitize the drain and kill the flies and their eggs.