Roughly, a higher combustion temperature increases combustion efficiency, but also increases NOx produced. Running lean increases the air:fuel ratio, which combusts more of the fuel at higher temperatures. On the flip side, EGR [1] is one of the primary techniques to reduce NOx at the expense of efficiency. Incidentally, it's actually somewhat common for diesel truck owners to do an EGR delete to increase fuel economy.
[1] https://en.m.wikipedia.org/wiki/Exhaust_gas_recirculation