For the "how it works" discussion... you're probably on the wrong forum.

That's pretty deep automotive engineering discussion there.
But, if your truck isn't getting at least reasonable highway mileage compared to similar trucks of the same vintage, there's probably something wrong. How many miles are on it? It's very possible that it's simply a bad O2 sensor. They can be far enough off to affect MPG without being far enough out of spec to throw a code. I'd start there. Also, silly little things like plug wires. A "bad" wire will cause misfires and throw codes, but a "degraded" wire could just give weak spark and poor combustion. Also spark plugs. Hell, you could even have a damaged or plugged cat.
You may have done some of that stuff already, I'm just thinking out loud. It's easy to overlook the simple things sometimes.
EGR passages are known to get plugged up, too. Carbon build-up in the head or on the pistons can cause problems. So, you're not on an unrealistic path. I'd just do the easy stuff first. Even do a good top-end cleaning with some SeaFoam.