Coffee drunk late in the evening resets the internal body clock which regulates a host of biological functions and genes according to a natural day/night cycle, research has shown.
The evidence suggests that the effects of caffeine go much further than simply making it harder to sleep.
Scientists discovered that drinking the equivalent of a double espresso three hours before bed-time can turn the body clock back nearly an hour.
Caffeine resets the clock by delaying a rise in the level of melatonin, the body's chief sleep hormone.
Fluctuating levels of melatonin help determine the natural time to go to sleep and wake up.
Two teams of British and US scientists carried out a study of volunteers and observed what happened to individual cells exposed to caffeine.
Joint lead researcher Dr John O'Neill, from the Medical Research Council Laboratory of Molecular Biology in London said: "The effect of caffeine on sleep and wakefulness has been long established, but its impact on the underlying body clock has remained unknown.
"These findings could have important implications for people with circadian sleep disorders, where their normal 24 hour body clock doesn't work properly, or even help with getting over jet lag.
"Our findings also provide a more complete explanation for why it's harder for some people to sleep if they've had a coffee in the evening - because their internal clockwork thinks that they're an hour further west.
"By understanding the effect caffeinated drinks have on our body clock, right down to the level of individual cells, gives greater insight into how we can influence our natural 24 hour cycle, for better or for worse."
Body clock patterns, also known as circadian rhythms, are governed by a "master clock" in the brain that governs the release of melatonin.
The mechanism, which synchronises clocks that exist throughout the body right down to the level of individual cells, is itself governed by exposure to light entering the eye.
Disruption of the body clock, for instance by working shifts or jet lag, is known to increase the risk of various cancers, heart disease, Type 2 diabetes and neurodegenerative disorders such as Alzheimer's.
In the US study conducted at the University of Colorado, researchers tested the saliva of five volunteers to look for signs of rising melatonin.
They found that stimulation by the caffeine equivalent of a double espresso coffee three hours before it was time to sleep delayed the expected melatonin surge by 40 minutes.
Caffeine and bright light combined extended the delay to 105 minutes.
To further investigate what was happening, the UK scientists led by Dr O'Neill added caffeine to human cells in the laboratory.
They found that at the cellular level, caffeine can turn the clock back directly by activating a receptor protein "switch" found in all cells.
Reducing levels of the switch protein on cell surfaces minimised the caffeine-induced body clock delay.
The findings are reported in the journal Science Translational Medicine.
Professor Kenneth Wright, from the University of Colorado's Department of Integrative Physiology, said: "This is the first study to show that caffeine, the most widely used psychoactive drug in the world, has an influence on the human circadian clock.
"It also provides new and exciting insights into the effects of caffeine on human physiology."
The results may help explain why caffeine-drinking "night owls" go to bed later and wake up later and may have implications for treating some circadian sleep-wake disorders, he added.