I wish this was a possible solution, but I had that same eng but in '99, and same code. Never figured it out... Solution was to get rid of the car.
I can only recall three car problems in my life that I could never figure out, this was one. Another was also a Benz with that same eng, same year as yours where it would die when put in gear until warmed up. Dealer couldn't figure that out either. Solution was to feed it hot air piped from the ex manifold via a clothes dryer duct. the eng didn't need to be hot, it just needed hot air! The other was driveshaft vibration (not Benz) that I dragged around with me for 20 years despite changing out so many parts over the years that it was literally a different vehicle. Now, several years later, the exact same vibe reappeared in my latest Benz.... Like before, everything looks/feels perfect, yet there it is. So while I love Benz overall, they can vex me and I may have to get rid of this one too.
Btw I scoured the web and every local Benz shop and dealer for a solution to the p0400 issue, which was in fact working perfectly. The dealer claimed to have never seen the issue, but I've heard that all my life about anything I have problems with. The dealer could not even tell me what in the programming trips p0400 so basically zero clues where to look other than what seems obvious.
If you find it, please post so others in that situation have something to go on. Best of luck to you...