The first thing you should do is find the codes stored in the ECM control unit, This will tell you if you have a sensor problem, your truck could be in safe mode and not letting it accelerate past 3000 rpm. until the code is cleared. I would check this first, Thanks ROY!
After your explanation, I would think the air flow meter is bad , the only way you can get it is to replace the throttle body top . I think this will fix your problem. your correct if it were in safe mode it would do it all the time. The P0100 air flow code , must have an open circuit. I hope this helps, ROY!