Glycyrrhizic acid (GA) is the substance with the highest content of triterpenoid saponins that can be extracted from licorice, and has anti-inflammatory, neuroprotective, and anticancer functions, among others. The aim of this study was to investigate the protective effect of GA on cognitive decline in middle-aged mice and explore its mechanisms. We injected GA by the tail vein of C57BL/6 mice and measured their cognitive levels using the Morris water maze. The Morris water maze results demonstrated that GA improved learning and memory abilities in middle-aged mice. Furthermore, the RNA-sequencing and flow cytometric analyses revealed that GA could increase T and B cells. We then confirmed the relationship between cognition and the immune system in the immune-deficient B-NDG mouse model. Our results suggest that GA improves cognition in aging mice by regulating T/B cell proliferation.