Other things to check are fuel pressure and injector size. Parts may have been changed to make the truck run for sale. No way to know what it has in it. Even the pcm may have been changed at some point.

I'll add to what the others have said. Since you don't know the truck's history(and it's done this since you have had it), you may have to go over every part of the EFI system and powertrain just to verify each part is what it should be and is working correctly.

Once you know that everything is mechanically and electrically correct, the only other option (unless you trade it like Tech said) is to take to a tuner and have the pcm program altered. There are dyno's that can do road load tests, not just full throttle pulls. Find someone that has one of these and can use it and you can see and alter the tune for increased mileage. This would be cheaper than a new engine swap. If you alter the internal engine parts very far from stock, you are most likely going to have to tune it anyhow.