Most of the time, this code is cause by a vacuum leak. Check for a hissing sound in the engine bay. Or use the carb cleaner spray method (spray in the suspected areas and if the engine idle increases or decreases, that would probably be the leak). Check loose hose clamps for rubber hoses and check for broken or cracked hose lines too.
From TSB
P0171 - System Too Lean (Bank 1) The Adaptive Fuel Strategy continuously monitors fuel delivery hardware. The code is set when the adaptive fuel tables reach a rich calibrated limit.
Fuel System:
�· Contaminated fuel injectors
�· Low fuel pressure or running out of fuel (fuel pump, filter, fuel supply line restrictions)
�· Vapor recovery system (VMV)
Induction System:
�· MAF contamination
�· Air leaks between the MAF and throttle body
�· Vacuum leaks
�· PCV system concern
�· Improperly seated engine oil dipstick
EGR System:
�· Leaking gasket
�· Stuck EGR valve
�· Leaking diaphragm or EVR
Base Engine:
�· Exhaust leaks before or near the HO2S
�· Secondary air concern
Powertrain Control System:
�· PCM concern