Here's a brake fuel consumption graph for a typical gasoline engine. Going up is increasing in Load up to full throttle at the red line and going right is increasing RPM. The green line shows the same power at different gear ratios, with two gear ratios points. The numbers are grams of fuel used to produce a kWh. The most efficient this engine can be is 206 grams of fue per kWh, or about 46.4% efficient if the fuel is your typical gasoline with about a kWh of energy for every 95.5g. Presumeably the "constant power output" line refers to the power needed to cruise at a constant highway speed on flat ground.
Now note the two gears (white dots along the green line), one at about 235g/kWh (40.6% efficent) and and the other at about 255g/kWh (37.5% efficient). Of course this vehicle could have one more gear at around 217.5g/kWh (43.9%). But if the engine were much more bigger and powerful the green line would be much lower, meaning the most efficient gear would be less efficient. A smaller engine, on the other hand, would raise that green line making it more possible to make a gear that sits closer to the 206g/kWh (46.4%) point.
Of course so far we've been talking about cruising at a steady speed. Once you need more power the green line goes up. (And if you need less it goes down of course). At the point of most power (high load and RPMs at top right corner where the red line on graph ends) you'll be using around 255g/kWh (37.5% efficiency).
Looking at the two dots representing the gears for this particular vehicle, if you were to need more power the lower dot would get best efficiency at WOT, around 220g/kWh (43.4%). The top dot looks like it could hit 210g/kWh (45.4%) at some 85% throttle, but could drop down to 215g/kWh (44.4%) at WOT.
Now what does all this mean for fuel mileage? Well, let's say this particular vehicle is getting 30mpg at the top gear in the graph. If it had one more gear at the right point you could cruise at the same speed and get 32.4mpg. But drop in a smaller engine and with the right gear that puts it around 210 to 215g/kWh you could be getting 32.7mpg to 33.5mpg.
However, the bigger and more powerful the engine the lower the potential fuel mileage, even with the best gearing. If the green line hits 235g/kWh and no better, then you maximum fuel mileage would be 30mpg at that speed.
Then comes into question if you need to cruise slower or faster. Going slower will lower the line, but reduce aerodynamic drag. So having a bigger engine with throw the line down into the even worse fuel efficiency zones making you potentiall get worse fuel mileage the slower you go. Having a smaller engine will mean your line will still be generally higher making it easier to put it into a gear that gets you superb fuel mileage, making you get better mileage over all due to still being efficient at the engine and getting less aerodyamic drag at the same time.
But going faster not only makes the line go up, it also makes the shift points go right towards higher RPM's. For an example, if you take the gearing as is in this graph and move the line up, the top gear there will possible cross over the 230g/kWh line, improving engine efficiency, but at the same time the greater aerodynamic drag would likely reduce fuel mileage. You can kind of see what would happen if the engine were larger or smaller or if there were taller gears on this same vehicle.