The performance of quantum technologies that use entanglement and coherence as a resource is highly limited by the effects of decoherence due to their interaction with some environment. In particular, it is important to take into account situations where such devices unavoidably interact with surrounding. Here, we study memory effects on energy and ergotropy of quantum batteries in the framework of open system dynamics, where the battery and charger are individually allowed to access a bosonic environment. Our investigation shows that the battery can be fully charged as well as its energy can be preserved for long times in non-Markovian dynamics compared with Markovian dynamics. Moreover, the non-Markovianity increase makes it possible to extract the total stored energy as work and the discharge time becomes longer. Our results indicate that memory effects can play a significant role in improving the performance of quantum batteries.