As in many situations, your truck could be losing power and running rough for different reasons. I would first look at the spark plugs and maybe spark plug wires as possible issues.
The purpose of a spark plug is to produce the “spark” necessary to ignite the gas and air in your truck’s engine. When this happens a combustion reaction takes place that provides energy to your truck. Each spark plug, in your vehicle, sits in its own cylinder. So if your vehicle has 4, 6 or 8 cylinders it also has the same number of spark plugs.
Each spark plug has a wire as well. The spark plug wires generally get replaced at the same time as the spark plugs. They become brittle and then need replacement.
To watch a short video on spark plugs; click on the link below.