What code are you getting?
Your experience sounds like mine a year ago, and I did everything you did, and the problem was a blocked egr tube. They get clogged up with carbon from egr vapors.
All M104 engines have this weakness, and these hot inlet pipes need to be reamed out about once every 60,000 miles.
Stevebfl, Steve Brotherton of Continental Imports, wrote a nice article on the home page that details this process:
You should have a code for low egr flow, because the carbon blockage restricts air flow to the egr valve, and a code is tripped, thinking the egr valve is stuck shut (or open), but if it was stuck in the open position, your car would idle badly.