Background: Disturbances of the sleep-wake cycle and other circadian rhythms typically precede the age-related deficits in learning and memory, suggesting that these alterations in circadian timekeeping may contribute to the progressive cognitive decline during aging. The present study examined the role of immune cell activation and inflammation in the link between circadian rhythm dysregulation and cognitive impairment in aging.Methods: C57Bl/6J mice were exposed to shifted light-dark (LD) cycles (12hr advance/5d) during early adulthood (from ≈ 4-6mo) or continuously to a “fixed” LD12:12 schedule. At middle age (13-14mo), the long-term effects of circadian rhythm dysregulation on cognitive performance, immune cell regulation and hippocampal microglia were analyzed using behavioral, flow cytometry and immunohistochemical assays.Results: Entrainment of the activity rhythm was stable in all mice on a fixed LD 12:12 cycle but was fully compromised during exposure to shifted LD cycles. Even during “post-treatment” exposure to standard LD 12:12 conditions, re-entrainment in shifted LD mice was marked by altered patterns of entrainment and increased day-to-day variability in activity onset times that persisted into middle-age. These alterations in light-dark entrainment were closely associated with dramatic impairment in the Barnes maze test for the entire group of shifted LD mice at middle age, well before cognitive decline was first observed in aged (18-22mo) animals maintained on fixed LD cycles. In conjunction with the effects of circadian dysregulation on cognition, shifted LD mice at middle age were distinguished by significant expansion of splenic B cells and B cell subtypes expressing the activation marker CD69 or inflammatory marker MHC Class II Invariant peptide (CLIP), differential increases in CLIP+, 41BB-Ligand+, and CD74 + B cells in the meningeal lymphatics, alterations in splenic T cell subtypes, and increased number and altered functional state of microglia in the dentate gyrus. In shifted LD mice, the expansion in splenic B cells was negatively correlated with cognitive performance; when B cell numbers were higher, performance was worse in the Barnes maze. These results indicate that disordered circadian timekeeping associated with early exposure to shift work-like schedules alone accelerates cognitive decline during aging in conjunction with altered regulation of immune cells and microglia in the brain.