Microglia maintain homeostasis in the central nervous system through phagocytic clearance of protein aggregates and cellular debris. This function deteriorates during ageing and neurodegenerative disease, concomitant with cognitive decline. However, the mechanisms of impaired microglial homeostatic function and the cognitive effects of restoring this function remain unknown. We combined CRISPR-Cas9 knockout screens with RNA sequencing analysis to discover age-related genetic modifiers of microglial phagocytosis. These screens identified CD22, a canonical B cell receptor, as a negative regulator of phagocytosis that is upregulated on aged microglia. CD22 mediates the anti-phagocytic effect of α2,6-linked sialic acid, and inhibition of CD22 promotes the clearance of myelin debris, amyloid-β oligomers and α-synuclein fibrils in vivo. Long-term central nervous system delivery of an antibody that blocks CD22 function reprograms microglia towards a homeostatic transcriptional state and improves cognitive function in aged mice. These findings elucidate a mechanism of age-related microglial impairment and a strategy to restore homeostasis in the ageing brain.