The performance of quantum technologies that use entanglement and coherence as resource is highly limited by decohering effects due to their interaction with some environment. Particularly, it is important to take into account situations where such devices unavoidably interact with a 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 and its energy can be preserved for long times in non-Markovian dynamics compared with Markovian dynamics. In addition, the total stored energy can be completely extracted as work and discharge time becomes more longer as non-Markovianity increases. Our results indicate that memory effects can play a significant role in improving the performance of quantum batteries.