If you've ever walked into the bathroom, lifted up the toilet seat and been startled by several small insects flying erratically from the toilet bowl, then you have met the drain fly. Drain flies are tiny gnats, usually 1/5 to 1/6 inch long, with oversized wings that look out of place on their small bodies. While drain flies are harmless, they do not bite or sting, their mere presence can be quite annoying. Drain flies typically breed in the slime and debris found inside drains and often seek out infrequently flushed toilets for the stagnant water. You need to wipe out all of their breeding grounds to rid yourself of them.
Clean the toilet. Drain flies are attracted to the ring of slime located under the lip of the toilet bowl. Clean the inside of the toilet bowl with a bowl cleaner and a scrub brush. Flush the toilet once you finish scrubbing it.
Lift the top of the toilet off the toilet. Examine the inside of the toilet for any other drain flies. If the inside of the tank is dirty, scrub it as well. Flush when finished. Place a toilet cleaning tablet, preferably one with bleach, in the tank. This will help deter the flies from landing in the toilet to rest or try to breed.
Coat the inside of clear plastic container with petroleum jelly. Place the container upside down over the shower drain in the bathroom. You can also place it over the sink drain. If any flies emerge from the drain, they will stick to the petroleum jelly and you will know where the flies are coming from. Check the containers every few hours for flies.
Clean the sink drain. You can unscrew the sink drain trap, which is the "J" shaped piece of pipe directly beneath the sink. Wash the drain trap out with hot water and a stiff wire brush to remove any debris and slime in which the flies can breed. Re-attach the drain trap.
Clear any debris down in the shower drain with a plumbing snake. There is likely old hair and soap scum in your shower drain, and drain flies are attracted to these slimy masses. Push the plumbing snake down into the drain and if you feel resistance, sharply ram it forward several inches before pulling it back out. You will likely drag out a huge wad of hair and other debris. Throw away the debris. Use the snake several more times to be sure you have removed all of the debris. Run hot water through the drain for several minutes.
Avoid using drain cleaner on either your sink or shower drain. This is harmful to your pipes, you are better off using a plumbing snake to remove debris.