Plants carry out photosynthesis during the day time and respire throughout. They manage to produce more amount of oxygen than what is needed during the respiration. The oxygen produced is liberated during photosynthesis while some part of it gets trapped in the cells to be utilised for respiration. This is how they manage to restore the amount of oxygen.