For road biking I can't provide much advice, but I'm sure Dylan Johnson does. He has a great YouTube channel and he does nothing but quote whitepapers and studies.
For XCO, one must learn to load/unload wheels as they go over obstacles. The more you practice this, the more efficient you get at it; so rather than just plowing through obstacles with the gas pedal floored, figure out how to traverse rocks and roots using weight shifting only. Learning to manual on flat ground with the seat post all the way down can probably teach you a ton about weight shifting.
Another big gain for me is learning how to judge how difficult a climb is and keeping a very steady pace up the climb. It takes practice, but the steadier your pace[power output] is, the more efficient it will be.
If you're not shifting constantly, you're not doing things correctly :) You should be shifting before you hit your climb and should time when you need to put power down with your shifts so you don't have to shift under load.
An oval chainring can help prevent pedal stalls at the top of stroke (I use the OneUp Components Cinch 32T) on both climbs and rock gardens.
Make sure your bike fits your body as we're all built pretty differently. Literally learn everything about stack height, seat tube angle, bar rise, head tube angle, reach, bottom bracket height, wheel base, chainstay length, etc. There's important pedaling dynamics like anti-squat that are affected by everything in that list :)
And of course, training, weight loss, etc as you probably already know.