Real-world memories are formed in a particular context and are often not acquired or recalled in isolation(1-5) . Time is a key variable in the organization of memories, as events that are experienced close in time are more likely to be meaningfully associated, whereas those that are experienced with a longer interval are not(1-4). How the brain segregates events that are temporally distinct is unclear. Here we show that a delayed (12-24 h) increase in the expression of C-C chemokine receptor type 5 (CCR5)-an immune receptor that is well known as a co-receptor for HIV infection(6-7)- after the formation of a contextual memory determines the duration of the temporal window for associating or linking that memory with subsequent memories. This delayed expression of CCR5 in mouse dorsal CA1 neurons results in a decrease in neuronal excitability, which in turn negatively regulates neuronal memory allocation, thus reducing the overlap between dorsal CA1 memory ensembles. Lowering this overlap affects the ability of one memory to trigger the recall of the other, and therefore closes the temporal window for memory linking. Our findings also show that an age-related increase in the neuronal expression of CCR5 and its ligand CCL5 leads to impairments in memory linking in aged mice, which could be reversed with a Ccr5 knockout and a drug approved by the US Food and Drug Administration (FDA) that inhibits this receptor, a result with clinical implications. Altogether, the findings reported here provide insights into the molecular and cellular mechanisms that shape the temporal window for memory linking.