Recent evidence suggests alterations in the gut microbiota-brain axis may drive cognitive impairment with aging. In the present study, we observed that prolonged administration of D-galactose to mice induced cognitive decline, gut microbial dysbiosis, peripheral inflammation, and oxidative stress. In this model of agerelated cognitive decline, Cistanche deserticola polysaccharides (CDPS) improved cognitive function in Dgalactose-treated mice by restoring gut microbial homeostasis, thereby reducing oxidative stress and peripheral inflammation. The beneficial effects of CDPS in these aging model mice were abolished through ablation of gut microbiota with antibiotics or immunosuppression with cyclophosphamide. Serum metabolomic profiling showed that levels of creatinine, valine, L-methionine, o-Toluidine, N-ethylaniline, uric acid and proline were all altered in the aging model mice, but were restored by CDPS. These findings demonstrated that CDPS improves cognitive function in a D-galactose-induced aging model in mice by restoring homeostasis of the gut microbiotabrain axis, which alleviated an amino acid imbalance, peripheral inflammation, and oxidative stress. CDPS thus shows therapeutic potential for patients with memory and learning disorders, especially those related to gut microbial dysbiosis.