I replaced everything as well with no improvement. I then decided to replace the intake manifold gasket and found at the back of it there is a vacuum hose that connects to a canister used to "Store" vacuum for the exhaust flap valve. I decided to eliminate that system so the vacuum ports are now plugged and the X3 has a constant deep growl which is acceptable to me, a side effect, no more rattle.
Second suggestion: replace the Oil Pan gasket, sometimes there are small leaks that will suck air but only leak a small amount of oil (Right hand side, passenger side for USA). This is a major repair, took me 21 hours, I hate those power steering connections.
I did both repairs during the same week and voila, no more lean codes. Hard to pin point the culprit.
Good Luck!