Fungus gnats lay their eggs in potting soil, which then hatch, grow and start flying around your house. Allow the soil to dry out more between waterings. You could also use Bt (Bacillus thuringiensis israelensis) in a liquid form - it is an organic way to rid your potting soil of the juvenile gnats. It smells awful - keep it in a sealed plastic bottle after you open it. Theer are also sticky cards coated with glue that trap lots of the flying ones - their blue and yellow colors attract the gnats.