Depression is a common chronic psychiatric illness, which is resistant to medical treatments. While melatonin may alleviate certain depression symptoms, evidence for its efficacy against core symptoms is lacking. Here, we tested a mechanism whereby melatonin rescues the behavioral outcomes of the chronic unpredictable mild stress (CUMS) mouse model of depression. CUMS mice showed depressive behaviors to tail suspension, open field behavior, and sucrose preference test, and cognitive dysfunction in the Morris water maze. Impairments in these measures were relieved by melatonin treatment. Moreover, CUMS mice had impaired glymphatic function across the sleep-wake cycle due to the astrocytic loss and disturbance of circadian regulation of the polarized expression of aquaporin-4 (AQP4) water channels in perivascular astrocytes. EEG results in CUMS mice showed a reduced total sleep time and non-rapid eye movement (NREM) sleep, due to sleep fragmentation in the light phase. CUMS mice lost the normal rhythmic expressions of circadian proteins Per2, Cry2, Bmal1, Clock, and Per1. However, the melatonin treatment restored glymphatic system function and the polarization of AQP4, while improving sleep structure, and rectifying the abnormal expression of Per2, Bmal1, Clock, and Per1 in CUMS mice. Interestingly, Per2 expression correlated negatively with the polarization of AQP4. Further studies demonstrated that Per2 directed the location of AQP4 expression via interactions with the α-dystrobrevin (Dtna) subunit of AQP4 in primary cultured astrocytes. In conclusion, we report a new mechanism whereby melatonin improves depression outcomes by regulating the expression of the circadian protein Per2, maintaining the circadian rhythm of astrocytic AQP4 polarization, and restoring glymphatic function.