Postoperative cognitive dysfunction (POCD) is a medically induced, rapidly occurring postoperative disease, which is hard to recover and seriously threatens the quality of life, especially for elderly patients, so it is important to identify the risk factors for POCD and apply early intervention to prevent POCD. As we have known, pain can impair cognition, and many surgery patients experience different preoperative pain, but it is still unknown whether these patients are vulnerable for POCD. Here we found that chronic pain (7 days, but not 1 day acute pain) induced by Complete Freund’s Adjuvant (CFA) injected in the hind paw of rats could easily induce spatial cognition and memory impairment after being exposed to sevoflurane anesthesia. Next, for the mechanisms, we focused on the Periaqueductal Gray Matter (PAG), a well-known pivotal nucleus in pain process. It was detected the existence of neural projection from ventrolateral PAG (vlPAG) to adjacent nucleus Dorsal Raphe (DR), the origin of serotonergic projection for the whole cerebrum, through virus tracing and patch clamp recordings. The Immunofluorescence staining and western blot results showed that Tryptophan Hydroxylase 2 (TPH2) for serotonin synthesis in the DR was increased significantly in the rats treated with CFA for 7 days and sevoflurane for 3 hours, while chemo-genetic inhibition of the vlPAG-DR projection induced obvious spatial learning and memory impairment. Our study suggests that preoperative chronic pain may facilitate cognitive function impairment after receiving anesthesia through the PAG-DR neural circuit, and preventative analgesia should be a considerable measure to reduce the incidence of POCD.