"You have about ten minutes to act on an idea before it recedes back into dreamland so when you're excited about an idea, start writing about it immediately." -- Buckminster Fuller
This is especially important if you have an idea just as you are waking up or falling asleep. Often those ideas are the most creative because they carry a little of your dreaming self.
If you keep a notepad by your bedside you'll be less likely to let an idea escape. Some people prefer to use their phone to record their thoughts, either in a notes app or by recording a voice memo.
Remember not to judge your idea as soon as it pops up--that stops the flow. Sure, many of these ideas will not be worth pursuing, but if even one out of ten has value, that makes the process worthwhile.
PS: If you're not familiar with Buckminster Fuller, check out his Wikipedia profile. Born in 1895, he was an inventor and visionary. Long before most people gave it much thought, he advocated using renewable energy and doing more with less. He hoped for an age of "omni-successful education and sustenance of all humanity."