I'll take a stab at this one...My E320 did the exact same thing. A/C worked fine when first started, then quit as soon as the engine warmed up. You need to stick a set of gauges on it to check the high and low pressure, not sure about MB, most cars are around 50-60lbs onthe low side and 200+ on the high. The fact that your a/c comes on at first indicates you must have sufficient pressure to make the low pressure switch cut the compressor on, so you probably don't have a leak in the system.. My problem was the aux cooling fans. One must be running continuously when the a/c is on or your condenser core will heat up and make the a/c get hot.
Disconnect the leads to your fans and put 12v to them individually to see if they are working. If they both work straightwired, then see if one comes on with the a/c and the other after the car sits idling long enough for the other fan to come on. If the fans work hotwired but not with the sensors, you have bad sensors.
I replaced the fans and cured the problem. Unfortunately this is not as simple an operation as it was in my old 123 diesel. I had to remove the radiator to access the fans. The fans aren't cheap (almost $300). I removed the pair and discovered they both were gummed up with pine needles and dirt. Cleaned them out and got one working. i tried to get out cheap, so I put one new and one old one back in and it worked for about a month before I had to take the whole blasted thing back apart to replace the other old fan. Lesson is, if they both look gummed up, replace the pair so you don't have to tear the radiator back out again. hope this helps - Miami Beach AC Duct Cleaning