Get Rid of Gnats
If you often leave your window open and find that gnats are swarming inside your home, buy some very fine window screen. Even if you already have a screen up, it may not be fine enough to keep gnats out. These are easily replaced and can be purchased at local hardware stores.
Change the lightbulbs outside your home. Ordinary lightbulbs produce a type of white light that attracts gnats, especially biting midges. Sodium lights produce an orange light that attracts fewer insects.
Put some BTI, Bacillus thuringiensis, in any water sources near your home that you think the gnats may be coming from. Like mosquitoes, gnats lay their eggs in water. BTI comes in different forms depending on the type of gnat it is targeting. Ask an employee wherever you purchase it to help you figure out which is best. BTI is an all-natural agent that will kill off gnats and eggs without hurting other wildlife.
Mix together about a tsp. of dish soap with a solution of about half water and half vinegar in a few small bowls or containers. Scatter these homemade traps around your home or just outside it. The vinegar will attract gnats, and the dish soap will make the water more dense so they can't fly out of it.