You can also flush drains with hot water and consider an enzyme-based drain cleaner designed to break down organic material. Follow the product instructions carefully, and avoid using boiling water if your plumbing could be damaged by high temperatures.
Next, deal with moisture. Repair leaks, clear slow drains, and prevent standing water from accumulating. Improve bathroom ventilation by using an exhaust fan or opening a window when possible. Keeping surfaces and drains as dry as practical can make the environment less attractive to these insects.
Prevention is just as important. Clean sink and shower drains regularly, remove hair and soap residue, keep floor drains maintained, and periodically flush drains with hot water. These simple habits can reduce the organic buildup that drain flies depend on.
The bottom line: those tiny flies are often a warning sign, not the main problem. If they keep returning despite thorough cleaning, there may be a hidden blockage, leak, or drainage issue. In that case, having a plumber inspect the system can help identify and eliminate the underlying source.