This is going to sound odd, it's experience talking though.
Look at your battery cables where they go into the ends by the battery and the other ends of them. Do you see the insulation pulled back slightly and greenish color instead of nice clean copper? If so.. consider replacing them.
I chased P0171, replaced the egr tube (they crack at intake manifold), checked grounds in the harness etc etc etc. Then had guy who had been a GM mechanic for years tell me to replace the cables. Since I had done everything else, I did. Fixed the issue and when I opened up the insulation on the old ones I found a decent amount of corrosion which messes with the voltage of the vehicle.