For what it's worth:
I had an Audi TT that I bought with a CEL on and P0171. I drove it for close to 8 months with that light on because I couldn't figure it out. I joined an Volks forum and went on a cruise with them after 8 months, and the night before, I went to Autozone for a few cleaning supplies, and since I have a rewards card, I went ahead and fell for the "Buy a Bottle of Injector Cleaner" at the counter since it put me above the $20 limit to earn a "point". Didn't buy it intentionally is what I'm getting at. I put it in the tank and filled up (it was with Premium, since the TT is a turbo 4 cyl, in case it matters for anyone reading this). I went out the next day on the cruise with the VW guys and met up with a Ferrari and my build TT was the fastest car in the group (still no Ferrari), so we were getting on it pretty hard down some back roads, and after around 3 hours of very heavy driving, I was at the last stoplight before my house and when I took off, I got on it one more time and it fell on it's face, the CEL flashed like I had a misfire, then I regained power, the CEL went off and it never came back on Had it inspected and it passed and was good after that until I sold it.
Over the 8 months of struggling to find the cause (without paying the dealership), I was told by countless people it was FOR SURE a vacuum leak, or it was my K&N taking in too much air for the fuel pump to keep up. I switched to a stock airbox, didn't help. Sprayed around the engine for leaks, didn't help. Was on the verge of switching to all silicone hoses and a bottle of fuel injector cleaner and some aggressive driving fixed it. I've always assumed it was a clogged injector or fuel line causing not enough fuel to make it to the engine and when it "fell on its face", it cleared the blockage. This is just my experience with this code though. It was incredibly frustrating. Maybe this will help either you, or someone else down the road who is plagued by the P0171.
By the way, after telling this to a few people, one of them had been a dealer mechanic for years and years and he said that was the common "fix" for lean conditions. Fuel injector cleaner and "spirited drives" in a customer's car. Take it for what it's worth. He was obviously crazy enough to work for a stealership for years....
