Depends on the situation and years of trucks being talked about. Most modern trucks get fantastic mileage compared to their older counterparts. For example my 1990 F250 5.8 averages about 13 with careful driving. The 1990 7.3 crew cab got 19 consistent with it breaking over 20 on many highway trips. In my scenario the diesel option is MUCH cheaper to run despite the extra cost differences. Now with modern trucks getting 18-20 in a gasser is about the same as their diesel counterparts so it really only makes sense to go diesel if extensive towing is going to be a factor. If I ever win the lotto I'll probably spend the coin and actually get a modern truck
Most modern gasoline trucks (1/2 tons and midsize) are lucky to get 17-18 mpg combined. I know that certain engines (ecoboost) are rated higher than that, but go look at the real world results: most of the owners are getting far lower than the EPA ratings in real-world conditions.
The Ram ecodiesel can easily squeeze out low 20's and the 2.8l Duramax can get into the mid to high 20's for combined driving. There is a significant efficiency discrepancy between the 2 engine types. The tradeoff is that diesels cost more to maintain and run.
Gasoline engines have become somewhat more efficient, but the OEM’s have also been using lots of little tricks to enhance efficiency (front air dam’s, higher gearing, cylinder de-activation). When these trucks get used for offroading or overlanding, a lot of those tricks (and their efficiency gains) fall by the wayside.