I had something similar in my truck that I had for YEARS. A tinny kind of rattle which happened under hard acceleration or on a hill on the highway. Same truck as yours. Here is what I did to finally get rid of it:
1. Followed the decarbon procedure here:
The right way to decarbon the OHV 4.0 (Ford TSB) Used PM-3, not Seafoam.
2. Still rattled after the third application so I decided to replace the maf (tried cleaning it with maf cleaner multiple times which did nothing) and the EGR valve (make sure you get the right one for your truck, they can be tricky). It was pretty clogged with carbon and I didnt bother trying to clean it.
3. Put in new spark plugs and wires.
Rattle was FINALLY gone and it feels like driving a new truck.