The accumulation of adenosine is strongly correlated with the need for sleep and the detection of sleep pressure is antagonised by caffeine. Caffeine also affects the circadian timing system directly and independently of sleep physiology, but how caffeine mediates these effects upon the circadian clock is unclear. Here we identify an adenosine-based regulatory mechanism that allows sleep and circadian processes to interact for the optimisation of sleep/wake timing in mice. Adenosine encodes sleep history and this signal modulates circadian entrainment by light. Pharmacological and genetic approaches demonstrate that adenosine acts upon the circadian clockwork via adenosine A1/A2A receptor signalling through the activation of the Ca2+ -ERK-AP-1 and CREB/CRTC1-CRE pathways to regulate the clock genes Per1 and Per2. We show that these signalling pathways converge upon and inhibit the same pathways activated by light. Thus, circadian entrainment by light is systematically modulated on a daily basis by sleep history. These findings contribute to our understanding of how adenosine integrates signalling from both light and sleep to regulate circadian timing in mice.