Most people recognise gnats as the pesky little bugs that are prevalent at summer picnics. Unlike mosquitoes, gnats don't bite; rather, they form annoying swarms in the air, attracted to light or moisture. Certain gnats stay in the soil or grass during the day, only to swarm up at night. In order to kill the gnats, do a thorough sweep of your backyard to locate all areas where gnats might be laying eggs.
Eliminate all areas of standing water in your backyard, if possible. For example, if you have a birdbath or fountain, spill out all the water and spray the interior with a special gnat pesticide. This kills any eggs the gnats have laid.
Sprinkle gnat pesticide powder with DEET all over your lawn and bushes. This kills the gnats. Read the instructions carefully, reapplying the pesticide powder every day or every other day to make sure you eradicate the gnats and their eggs.
Soak rags in pine oil and hang them around the perimeter of your yard. The smell will repel future gnats from coming in.
Don't overwater plants, as this attracts gnats.