Book/Source: The Hobbit
Disclaimer: I don’t own Middle-earth, however much I’d like to live there.
Sometimes Bilbo dreamed of the Lonely Mountain, and ravens and runes and gleaming gold and gems. He always woke from those dreams thinking of Thorin and feeling melancholy. And at other times he dreamed of mirkwood and woke in a cold sweat, thinking of the spiders and deep darkness.
The nicest dreams were the ones that took him back to Rivendell in midsummer with the elves, beneath the jewel-bright stars.
Finally, on a particularly restless night, Bilbo gave up and went to his study. A sleepless night was as good a time as any to start writing his memoirs.