You also need to kill the eggs.
They usually lay in moist areas like sink drains. Keep those airtight when not in use and pour boiling vinegar down them a few times, especially the kitchen sink.
The adult fies only live a few days max and if they can't lay eggs or the eggs can't hatch then the population usually dies off in a week.
Also any standing water should be changed frequently or in the case of fish tanks made so the surface isn't smooth, to prevent eggs from being laid there.
Flies can also lay on fruits, keep any fruits in the fridge and peels need to be sealed so that the hatchlings cannot spread.
Change and toss animal litter daily to prevent eggs hatching there.
I had this problem before, it's like hell.