I had Codes P0171 and P0174 (banks 1 and 2 Too Lean) on a 2003 X5 3.0L. After inspecting the air intake system I found the "Intake Boot - "Tube Elbow" Throttle Housing to Air Boot" (see
Pelican Parts - Product Information: 13-54-1-440-102-M9) to be letting in air through the flexible tubing (quite a bit of air in this case ... the hose seems to have rotted or torn almost all the way through).
I purchased a replacement Air Boot from the dealer (under $20). Here are my replacement instructions but it is quite likely there is a better way.
There are three hose clamps that need to be removed and two small vacuum tubes that need to be unplugged. I did the vacuum tubes first and this is easy.
The hose clamp adjusting screw closest to the air intake (most "upstream"?) was in a position that made it inaccessible until the other two clalmps were removed.
The hose clamp screws that went to the throttle housing and the flexible tube were accessible though difficult to reach. I used a 1/4" socket on a screwdriver-like socket driver on the throttle housing clamp and I cut through the flexible tube before removing that clamp. This gave enough movement to "twist" the air intake to gain access to the upstream hose clamp screw. This allowed me to remove the old part.
Installation was more simple. I started with the throttle housing clamp, then the flexible tube and lastly the upstream clamp (with the adjusting screw put in a better position than before). I reattached the vacuum tubing (smaller diameter on top, larger on bottom). I then cleared the codes, drove the car for a couple of days (75 miles maybe), waiting for all the sensors to report. The car passed California smog test with no problem and the fault codes have not returned. This seemed to be a good deal for a $20 part, some knuckle-blood, forearm bruises, and the frustration of not knowing the outcome ahead of time.