You may need a larger capacity battery - it's recommended a 6.0Ahr battery or greater is used like the RYOBI 18V One+ 6.0 HP Battery
Vacuuming uses more power than in blower mode so, it's more time efficient if you start by blowing all the leaves into one area before vacuuming them up. This not only maximize battery run time, but it also helps dry any damp leaves as you go.
You should also avoid vacuuming leaves that are wet:
Wait until they've dried out as they are much harder to suck up and will consume lots of battery runtime.
Wet leaves also tend to clog up in the tube, reducing air flow and over time will degrade the life of the collection bag.