A bad or fouled MAF sensor can often cause lower gas mileage and other problems. It may or may not trigger a code in the computer. Cleaning the MAF is easy, and if you do it right, should be a harmless (and beneficial) part of your routine maintenence.
CRC sells a special MAF cleaner (most auto parts stores will carry it) that runs about $6.50 for a large bottle - probably enough to clean the MAF a dozen times.
After 2000 (I think?) Subaru started putting MAP sensors in cars instead of MAFs. If you have a MAP, this is not for you. If your engine bay looks like what's below, read on. The patient below is a 98 Legacy with a phase 2 2.2l engine.
First, unplug the MAF and remove the hose connecting the air filter assembly to the pre-throttle body air chamber. A good tug may be required to loosen the hose. (see photo 1-2)
Remove the air filter assembly by loosening the 2 clips near the fender and pushing the box toward the engine. Set the assembly in a clean place. There's no need to remove the MAF housing from the air filter cover, although there are just 4 bolts holding it on. (photo 3).
Take your cleaner, and spray the MAF element. (Photo 4). Don't let the straw of the can touch the MAF! Don't touch it with ANYTHING. Move the assembly around, making sure you spray from every possible angle. The CRC cleaner dries very fast, so you don't need to worry about wiping the housing down.
Installation is the reverse of removal. Don't forget to put the MAF plug back in before you start the car!