Caffeine acts through multiple mechanisms, however the most prominent of which is the antagonism of adenosine receptors (ADORA1 and ADORA2) and consequently it prevents the onset of drowsiness induced by adenosine.
Normally adenosine accumulates as time pass in the neuronal synapse.