Mine had been doing that for 3 weeks, dealer just replaced the Mass Air Flow. It took them a while to track it down, tried replacing the fuel filter, ...
Tried the fuel filter, was partially resricted but, did not solve the problem. Was taken to an Audi dealer who replaced the MAF and it seems to have corrected the problem. The MAF with labor I think was $325.
I took mine to Advanced Auto Parts and they hook their computer up to the diagnostics and when they saw there was no problem they turned it off for me for free. I needed it done to run through emissions. Problem solved.