Every species of insect have an important role to play in the ecology, whether we like them or not. They in my opinion, are far more important than the humans are, when considering their role in nature. Ecologically, human is a harmful species, considering pollution, deforestation, mass extinction.
* Bees, wasps are pollinators
* ichnuemen wasps keep the number of caterpillar and insect larvae down and in balance
* flies and their larvae function as decomposers, otherwise the planet would be shoulder high with corpses
* beetles are similar scavengers, converting plant material to humus /compost
* ladybirds are predators that keep aphid population in balance - think of the gardener who are thankful that ladybirds eats the greenflies that swarm on rose bushes
* spiders are predators that keep population of flies in balance
* ants aerate the soil (and earthworms do) enabling water and humus/compost to diffuse into the soil making it fertile
* mosquitos are not dangerous in themselves, the malaria is carried by only species, and is parasitic species, which is carried by the Anopheles mosquito.
Those few bugs that manage to enter our home are a very very tiny minority of the population. Best is to stay calm and humanely remove them from our homes. Houseflies are easy to remove, they are attracted to the sunlight, it is a simple matter of turning off indoor lights, and opening the window, and very soon they will fly out through the open window.