You can put some sterile sand on top of your soil/medium. They don't like the sharpness of the sand. Get them out first by tapping or knocking on the pot. They can come up from your drains, so hang those strips over your sinks, ect.

I saved this from overgrow or somewhere:
FUNGUS GNAT MANAGEMENT

Non-chemical (cultural) methods:
Potting media containing compost less than 6 months old may be more attractive to fungus gnats than that containing "older" compost. However, some of the less attractive potting mixes may result in increased plant injury because larvae may feed on plant roots rather than on fungi in the media.

Avoid over-watering. Over watering contributes to fungal and fungus gnat larval development. Conversely, too little watering may aggravate fungus gnat larval injury to plants, because larvae may enter the plant stems in search of moisture.

Avoid introducing infestations into a treated planting by bringing in infested plants.

Avoid providing habitats for fungus gnat development underneath benches, etc. If possible, separate plant propagation areas from the main plant production areas (by using separate houses or screening between these areas), since propagation areas generally have more severe fungus gnat problems.

Practice good sanitation: remove debris and old plant material from in and around greenhouses.

Potting media treatments (for larvae):
....... Biological control:
- Parasitic nematodes (Exhibit®, BioSys®, Guardian nematodes, Scanmask, Ecomask, etc.*,**) and others (S. feltiae, Heterorhabditis spp.)
- Predatory mites (Hypoaspis spp.)(1 to 50 per container)

Microbial insecticides:
- Bacillus thuringiensis var. israelensis (Gnatrol®*,**)

Insect growth regulators:
- azadirachtin (Azatin® EC*,**)
- fenoxycarb (Precision®*)
- kinoprene (Enstar®*,**)

Nerve-active insecticides
- chlorpyrifos (DuraGuard*,**)(surface spray)
- diazinon (PT® 265 KnoxOut® 2FM*,**)(surface spray)
- oxamyl (Oxamyl 10G*,**)

Foliar treatments (for adults):
chlorpyrifos (PT® 1325 ME Duraguard*,**)
cyfluthrin (Decathlon®)
diazonon (PT-265® KnoxOut® 2FM*,**)
horticultural oil (SunSpray®*)
oxamyl (Vydate®*) - no longer being produced for ornamental market
pyrethrins (Pyrenone® Crop Spray)
resmethrin (Resmethrin EC*,**)

Fogs and fumigants (for adults):
diazinon (PT-1500R® KnoxOut®*,**)
nicotine (Nicotine Smoke Generator*)
resmethrin (Resmethrin EC 26*,**)

Potato Cubes or Slices
Fungus gnat larvae migrate to feed on the underside of potato pieces placed in media. To determine whether container media are infested, use 1-inch cubes or slices of peeled raw potato imbedded about 3/8-inch deep into media. Pick up and examine the underside of each potato and the soil immediately beneath it about once or twice a week. Compare numbers of larvae before and after any treatment to determine whether larvae are being controlled.

Sticky Traps
Bright yellow traps, 3 x 5 inches or larger, are used to detect and identify flying insects. Traps containing insects can be wrapped with clear plastic (e.g., Saran Wrap) and taken to an expert for identification. Numbers of insects caught are not often a good indication of the number of pests infesting plants. Sticky traps are unlikely to provide pest control.

Orienting traps horizontal to the ground (facing the soil) is sometimes recommended when monitoring fungus gnats emerging from media. Vertical trap orientation (perpendicular to the soil surface) is more efficient overall if traps are also being used to monitor adults of other kinds of insects. Orient vertical traps so their bottom is even with the top of the plant canopy. Regularly adjust traps upward as plants grow. Hang traps from wires or use clothespins to clip the trap to a stick placed in media. Inspect traps at the same regular interval, once or twice a week. Count and record the number of each type of pest caught. Counting only the insects in a vertical, 1-inch-wide column on both sides of the trap gives results that are representative of the entire trap. Do not reduce trap size to 1-inch vertical strips.

Insecticides
Insect growth regulators (e.g., azadirachtin, kinoprene, diflubenzuron, cyromazine) applied to container media can be the most effective insecticides for controlling larvae. Drenching media with an organophosphate (acephate, malathion) or carbamate (carbaryl) also kills larvae, but this can be hazardous and will kill many different organisms, including beneficial species. For greenhouse applications, be sure the label specifically allows this use. Strictly follow all directions and precautions on the pesticide label.

Hydrated lime and certain registered materials like Agribrom and copper hydroxide are available to control algae under and around container-grown plant benches. Good control of algae can largely eliminate shore flies and may help to control fungus gnats and moth flies. Agribrom is effective and easy to use when applied through greenhouse irrigation systems at a rate of 10 to 35 ppm bromine for an initial application, followed at the recommended intervals by 5 to 10 ppm treatments as maintenance applications. These rates are generally not phytotoxic and give effective control.

Copper hydroxide can be applied about once per month as labeled. A slurry of 1 to 1-1/2 pounds lime per gallon of water applied about every 3 to 4 months controls algae. Prevent contact with plants because copper hydroxide can be phytotoxic. Some counties may restrict growers' use of hydrated lime. Avoid contaminating water with these materials.