Amyloid-β (Aβ) accumulation is one of the main pathological hallmarks of Alzheimer’s disease (AD). Porphyromonas gingivalis (P. gingivalis), the pathogen of chronic periodontitis, could cause Aβ accumulation and was identified in the brain of AD patients. Salvianolic Acid B (SalB) has been proven to have the neuroprotective effect. Whether SalB could protect against P. gingivalis-induced cognitive impairment is still unknown. In this study, a P. gingivalis-infected mouse model was employed to study the neuroprotective role of SalB. The results showed that SalB (20 and 40 mg/kg) treatment for 4 weeks could shorten the escape latency and improve the percentage of spontaneous alternation in the P. gingivalis-infected mice. SalB inhibited the levels of reactive oxygen species and malondialdehyde, while increased the levels of antioxidative enzymes (superoxide dismutase and glutathione peroxidase). SalB decreased the levels of IL-1β and IL-6, increased the mRNA levels of bdnf and ngf in the brain of P. gingivalis-infected mice. In addition, SalB obviously decreased the level of Aβ. SalB elevated the protein expression of ADAM10, while downregulated BACE1 and PS1. SalB increased the protein expression of LRP1, while decreased RAGE. In conclusion, SalB could improve cognitive impairment by inhibiting neuroinflammation and decreasing Aβ level in P. gingivalis-infected mice.