PO171 is the "Lean on Bank 1" code. If you didn't get anyother code then this means that whatever the problem is it's only effecting the right bank (I think bank 1 is right side cylinders). Vacuum leaks would generally be causing lean on both banks - 2 codes.
I suggest swapping the o2 sensors around and see if the problem swaps sides.
just for info i had the p171 code and had a vacum leak , the rubber elbow on the PCV tube. not always will the codes be tripped for both left and right bank lean code with a vacum leak, that same vac leak would trip serval differant codes eachtime i cleared them but the p171 stayed
I have a 98 5.4L with 94K miles. My "Check Engine" came on about 2wks ago with a p171 code. Turns out that I have a vacuum leak on a hose behind the "Air Intake Control Valve". I found it by using a 2' section of garden hose with one end held to my ear as I moved the other end around the various vacuum hoses (engine running). I'm waiting for the engine to cool before I reach back there to change out the short section of vacuum hose. I'm pretty sure that's what my problem is.
Thanks for the info, will check this as well. Since I cleaned the mass airflow sensor I have not had any problems. But, that is the way it has been acting. Runs fine for a while then out of the blue get the check engine light with the P171 code every time.