Placing bleach in strategic places while keeping your home free of excess moisture and rotting plant matter are the primary ways to rid your residence of gnats. Other ways of driving out gnats include covering any fruit and avoiding leaving standing water in sinks or containers.
Gnats often gather in sink drains. Prevent them from lurking in yours by pouring diluted bleach and several drops of dish-washing detergent in your drains, then plugging the drains overnight. In the morning, flush the drain. Repeat this step weekly.
Another method using bleach involves placing water with a small amount of bleach in pans and then placing the pans under refrigerators and freezers. Periodically check the pans for dead gnats. A variation of this technique swaps bleach for vinegar and a few drops of dish detergent. Gnats are attracted to the vinegar, but become trapped in the pan by the soap.
Vacuum gnats by aiming an attachment nozzle directly at them.
Another way to naturally get rid of gnats is by drowning them in apple cider vinegar. Those wishing to rid a home of gnats can place a plastic cup containing an inch of vinegar and a few drops of liquid dish soap in the kitchen or near potted plants.
While vinegar naturally attracts gnats, it needs the help of the dish soap to trap the insects in the liquid and drown them. Vinegar alone may not be enough to attract adult gnats. However, pieces of fruit added to the vinegar and soap mixture can help attract adult gnats to the trap. Vinegar and soap can also be sprayed in sinks or drains to kill gnats.
To help rid your yard of gnats, replace outdoor bulbs with sodium lights, which are not as bright as standard outdoor lights and therefore do not attract as many gnats. Burn citronella candles on patios, decks and in your yard, as these repel gnats and other insects.