Optoelectronic devices represent a promising method for emulating the human visual system. However, existing devices have difficulty retaining optical image information even after external stimuli are removed, hindering the integration of image perception and memory. The development of optoelectronic memory devices provides a feasible solution to bridge this gap. Artificial vision that simultaneously recognizes and stores ultraviolet (UV) images is particularly important because UV light carries information that cannot be detected by the human eye. In this work, we introduce a multilevel UV optoelectronic memory based on gallium nitride (GaN), which seamlessly integrates UV sensing and memory functions within a single device. SiO2 side gates embedded around the source and drain regions effectively extend the lifetime of photogenerated carriers, enabling dual-mode storage of UV signals in terms of threshold voltage and ON-state current. The optoelectronic memory demonstrates exceptional robustness with retention times exceeding 4×104 seconds and program/erase cycles exceeding 1×105. By adjusting the gate voltage, we achieve five unique storage states, each featuring excellent retention and efficiently regulating the erase time for fast erase. Additionally, the integration of a GaN optoelectronic memory array ensures that specific UV images are successfully captured and reliably stored for over 7 days. This research represents a significant advance in the field of optoelectronic memories and shows their potential in applications requiring long-term preservation.