I feel your pain. :) I have had this issue twice in the past three years but managed to bring it under control much more quickly the second time because I had learned what I was doing wrong the first time.
I have several house plants in two different areas of our home. The flies lay their eggs in the soil of the plants. However, the soil must be damp for the cycle to continue. I was watering my plants too frequently, not allowing the soil to dry completely between watering. As someone else mentioned, there is also a spray available for houseplants that you spray on the top of the soil but they will still come back if you are not letting the soil dry completely. I used the spray the first time around when the problem had gotten so bad that the flies were migrating all over the house. I didn't even get it out the second time when I noticed that they were back. Now I just make sure that I do not water a plant that doesn't need it at the time.
Also, most plants will dry out faster if they are outdoors, especially here in Colorado. If it is possible to move the plant outside, you will probably see quicker results. Just make sure the flies have died inside your home and the plant soil has dried prior to moving the plant back in.
I hope this helps and you are fly free soon.