If your Mazda 6 Air Flow Meter keeps failing the issue is most likely to much oil on a Mazda performance air filter, or to much blow by from the 6 engine.
The Mazda 6 Oxygen sensor is a critical part of the emmision control system and should be replaced as soon as it fails. Make sure to check the Mazda 6 diagnosics codes for proper replacement of the O2 Sensor.