Gnats are attracted to wet and decomposing organic matter, so removing any from the yard will reduce the likelihood of their congregating there. Some gnat repellents include DEET and vanilla.
Chemical solutions for killing gnats include BTi (also sold as Gnatrol), which can be applied to areas where larvae are hatching. Chemicals can be used in conjunction with traps to catch adult gnats.
Natural ideas for repelling gnats including placing fans in the area to make it difficult for them to swarm and using some natural oils such as vanilla, citronella and pine oil. Dryer or fabric softener sheets have also been known to repel them.