We investigate the photoelectrical and resistive switching properties of Pt/ZnO/Pt capacitor operated in unipolar mode under ultraviolet (UV) illumination. The oxygen photodesorption under UV illumination explains the photoconduction observed in initial and high resistance states. Meanwhile, oxygen readsorption at surface-related defects justifies the different photoresponses dynamics in both states. Finally, UV illumination significantly reduces the variations of resistance in high resistance state, set voltage and reset voltage by 58%, 33%, and 25%, respectively, stabilizing Pt/ZnO/Pt capacitor. Our findings in improved switching uniformity via UV light give physical insight into designing resistive memory devices.