From a 2000 4Runner FSM.... Not sure if you have California Spec Emissions or not so I will describe both since they are similiar.
P0171 - SYSTEM TOO LEAN (Fuel Trim)
Fuel trim refers to the feedback compensation value compared to the basic injection time. Fuel trim includes short-term fuel trim and long-term fuel trim.
Short term fuel trim is the short term fuel compensation used to maintain the air-fuel ratio at its ideal theoretical value.
For NON CAL SPEC, the signal from the heated oxygen sensor indicates whether the air-fuel ratio is RICH or LEAN compared to the ideal theorectical value, triggering a reduction in fuel volume if it is rich and an increase in fuel volume if it is lean.
Long term fuel trim is overall fuel compensation carried out long-term to compare for continual deviation of the short-term fuel trim from the central value due to individual engine differences, wear over time and changes in the usage environment.
If both the short term fuel trim and the long term fuel trim are LEAN or RICH beyond a certain value, it is detected as a malfunction and the MIL (check engine light) lights up.
For CAL SPEC, The signal from the A/F sensor is approximately proportional to the existing air-fuel ratio, and ECM comparing it with the ideal theorectical value, the ECM reduces fuel volume immediately if the fuel ratio is rich and increases fuel volume if it is lean.
Long-term fuel trim compensates for the deviation from the central value of the short term fuel trim stored up by each engine tolerance, and the deviation from the central value due to the passage of time and changes in the environment.
If both the short-term and the long-term fuel trim exceed a certain value it is detected as a malfunction and the MIL (check engine light) lights up.
P0171 Trouble areas -
1. Air induction system
2. Injector blockage
3. Mass air flow meter
4. Engine coolant temp. sensor
5. Fuel pressure
6. Gas leakage on exhaust system
7. NON CAL SPEC, Open circuit in heated oxygen sensor (bank 1 sensor 1) circuit
CAL SPEC, Open or short circuit in A/F sensor (bank 1 sensor 1) circuit.
8. NON CAL SPEC, heated oxygen sensor
CAL SPEC, A/F sensor
9. ECM
Just for reference, P0172 is the same but for the opposite detected condition (P0171 = lean, P0172 = rich).
I'll just describe the check procedures for the first three most common conditions and hope that solves the issue, if not the let me know and we can go through the rest.
1. Check the air induction system
Check for separation of the oil dipstick, oil filler cap, PCV hose, etc, these may cause the engine to run out of tune. Check for disconnection, looseness or cracks in the parts of the air induction system between the throttle body and cylinder head, this will cause air suction and cause the engine to run out tune.
2. Check injector injection
This really requires some special tools, but the injector volume should be between 60-73 cubic cm or 3.4-4.5 cubic in. You can also test the injector terminal resistance, it should be approx 13.8 ohms at 68