One of the most common causes of the p0171 error code is a dirty Mass Airflow (MAF) Sensor. The good news is that cleaning this sensor will only cost you about $5 and 10 minutes of your time. In this article, I walk you through the process of cleaning the Mass Airflow Sensor on a 2004 Toyota Corolla (this will also apply to a 2003-2014, as well as a Toyota Matrix and Pontiac Vibe), and then getting rid of the p0171 error.

Note: if you purchase something through one of our affiliate links we may earn a commission, at no extra cost to you.

What Causes a p0171 and p0174 Error Code?

A dirty or inoperative mass airflow (MAF) sensor triggers a p0171 and p0174 error code.

One other note before we get started, a dirty MAF can also be the cause of an excessively low idle RPM. If your vehicle threatens to quit while you are sitting at a stop light, or otherwise idling, it is probably not a bad idea to clean the MAF, it just might solve your problem.

If you have the error code p0171 (System too lean (Bank 1)), you’ve probably read it through the OBD2 port on your vehicle (often located underneath the steering wheel). If you don’t have one of these readers, they are really inexpensive, and you should consider buying a cheap OBD2 reader. There are also Bluetooth OBD2 readers that plug in and sync up to an app on your phone. Check out this article that describes these OBD2 devices. Having this capability makes engine diagnostics that much easier.

Tools and Materials:

Okay, let’s get started.

How to Clean a Mass Airflow Sensor

The first step is to pop the hood and locate the MAF. It is usually located right next to the air filter.

Depress the plastic tab, and pull out the connector.

Then, use a Philips screwdriver, and remove the 2 screws that hold the MAF in place.

Once the screws are removed, you can go ahead and gently lift the MAF straight upward.

Be a little bit careful, because there are sensitive sensors inside. Another thing to watch out for is that there is a rubber gasket, and you don’t want to damage that.

Once you have the MAF out, inspect it to check how contaminated the sensors are. Also check the condition of the rubber gasket. If the gasket is damaged, cracked, or leaking, this could be another reason for the P0171 code.

Here is a picture showing the rubber gasket (near the top of the image), and a contaminated sensor. Notice the grime built up on the sensor bulb.

At this point, use some of your mass airflow sensor cleaner, and spray the bulb off.

Here is a picture of the mass air flow sensor cleaner that I have used.

You’re using the chemical action of the spray, but also the mechanical action. So make sure you spray it forcefully. Do not touch the sensor, as it can easily be damaged that way. Just make sure that you have a nice strong spray on the sensor bulb.

There are also some sensors down in the plastic area of the MAF. Locate these, and check if those are contaminated as well. It is less likely that these are contaminated, but if they are spray those with cleaner as well.

Here is a view looking down into the sensor body. You can see some sensors down inside.

This this is what the clean MAF looks like. Noticed that it is shiny. It will still be a darkish brown color, but now it will look more like maple syrup, instead of chocolate cocoa.

That’s it. You are now ready to gently insert the MAF back into its slot. Make sure you put it back into the correct orientation. And don’t touch the sensor to the side walls at all. Also be careful that you seat the rubber gasket correctly. You don’t want to crush that, or let in extra air flow around the gasket.

Now re-insert the two screws, and tighten them up. They don’t have to be super tight, so don’t risk stripping the screws.

Finally, re-insert the plastic clip. Make sure you press it in tightly, until you hear a positive click.

That’s it! If you have an OBD2 reader, use that to reset the error codes that you may have had.

If the error code still comes back after cleaning the MAF, there could be other problems, including a bad sensor.

If you determine you need a new sensor (or it was damaged in the cleaning process), here’s a link for the replacement.

There are also cheaper off-brands available, but usually those are not recommended for these particular sensors.

Thanks for reading this article on cleaning a Mass Airflow Sensor. I really hope you found this helpful.

Tools and Materials:

For more information on Toyota Corolla maintenance, check out these articles:

Maintenance Articles on Toyota Corollas

Find this article useful? Get more articles like this to your inbox, sign up for our mailing list!