A good night's rest is known to boost your memory, so you don't forget that all-important task on your to-do list.
But sleeping well also helps the body 'remember' how to fight infections, researchers believe.
They said it ensures the immune system can store features of invading germs so the body can tackle them in future.
Jan Born, of Tuebingen University in Germany, said memories and immune systems process information in similar ways - taking initial information in a short-term store then laying it down in longer-term storage as we sleep.
Writing in the journal Trends in Neurosciences, a team led by Professor Born suggested we encode such information during sleep so as not to interfere with urgent or 'acute' information processing when we are awake.