Postoperative cognitive dysfunction (POCD) is a severe neurological complication after anesthesia and surgery. However, there is still a lack of effective clinical pharmacotherapy due to its unclear pathogenesis. Caffeic acid phenethyl ester (CAPE), which is obtained from honeybee propolis and medicinal plants, shows powerful antioxidant, anti-inflammatory, and immunomodulating properties. In this study, we aimed to evaluate whether CAPE mitigated cognitive impairment following anesthesia and surgery and its potential underlying mechanisms in aged mice. Here, isoflurane anesthesia and tibial fracture surgery were used as the POCD model, and H2O2-induced BV2 cells were established as the microglial oxidative stress model. We revealed that CAPE pretreatment suppressed oxidative stress and promoted the switch of microglia from the M1 to the M2 type in the hippocampus, thereby ameliorating cognitive impairment caused by anesthesia and surgery. Further investigation indicated that CAPE pretreatment upregulated hippocampal Sirt6/Nrf2 expression after anesthesia and surgery. Moreover, mechanistic studies in BV2 cells demonstrated that the potent effects of CAPE pretreatment on reducing ROS generation and promoting protective polarization were attenuated by a specific Sirt6 inhibitor, OSS_128167. In summary, our findings opened a promising avenue for POCD prevention through CAPE pretreatment that enhanced the Sirt6/Nrf2 pathway to suppress oxidative stress as well as favor microglia protective polarization.