Fungus gnats are really only of concern if they are causing damage to seedlings or cuttings; established plants are not harmed. Fungus gnats are often more numerous in composts that are constantly wet, allowing compost to dry can reduce infestations, provided this does not affect the health of plants. Potting media formulated for houseplants is the best choice for indoor plants. If the adult flies are a nuisance, their numbers can be reduced by placing yellow sticky traps near the plants. These are widely available from garden centres.
Biological control is also an option. There are pathogenic nematodes (Steinernema feltiae), predatory mites (Hypoaspis miles) and a predatory rove beetle (Atheta coriaria) are sometimes available by mail order from various biocontrol supply companies. These biocontrols are added to the potting compost where they will help control the eggs, larvae and pupal stages in the fly's life cycle.
Contact insecticides such as pyrethrum (considered organic e.g. Py Spray Garden Insect Killer or Bug Clear Gun for Fruit & Veg), deltamethrin (e.g. Bayer Sprayday Greenfly Killer) or lambda-cyhalothrin (e.g. Westland Resolva Bug Killer) will control the adult flies but this may give only temporary respite if more adults emerge from pupae in the compost. There are no synthetic pesticides available to the amateur that are approved for use on cultivated mushrooms.
Pesticides for gardeners (Adobe Acrobat pdf document outlining pesticides available to gardeners)
Biological control suppliers (Adobe Acrobat pdf document)