Flies can be a major problem during the summer months, and it can be difficult to get rid of them altogether. You can try, however, multiple control methods that include sanitation efforts, barriers and physical elimination of the flies from you home.
The first step if you have a lot of flies in your house is to prevent them from entering by closing all the windows and doors. If this isn't possible because the hot weather, use screen doors and window guards.
Clean up everything the flies might be attracted to. Flies are generally attracted to any kind of food that you might have on display, and are particularly fond of canned pet food, excrement from pets and sugary substances. Making sure that these are kept to a minimum within the home to make sure that flies aren't tempted to come inside.
Eliminate all the flies that are already in the house. The easiest way to do this is by using bug spray or a fly swatter if there aren't too many flies. Bug sprays are effective, although they can be harmful to both pets and people.
Eliminate the flies from outside the home that might try to get in. Hang some sticky fly strips on porches or sheds. Compost heaps, garbage cans and litter boxed tend to be areas where flies congregate in large numbers, so place traps in those areas as well.