Often times it is some sort of existential freak-out. The idea of not existing someday just randomly seems terrifying. However, it is short lived. Usually it is just like "uhg, here we go again, freaking out about dying someday" and then I just finally conk out after dealing with it.
I'd say this has been going on and off for about 10 years or so. I have mentioned it to friends but since it is so brief I find it more annoying than anything else--so I have just dealt with it instead of reaching out for real help (shrink, antidepressants, etc). However, I recently had a random idea of what might be going on:
I am actually freaking out about another day going by.
Instead of directly fearing mortality like I originally thought, I am actually finding going to sleep symbolic of time elapsing, and that is what I am fearing. It is an indirect fear of mortality--and at a time when my mind is in sort of a weir transitional state.
Humans, like any other animal, were built to fear in order to avoid dying. But unlike other animals, being human means that we understand our own inevitable mortality. So a very important lifeskill to learn is to accept this or at least deal with it in some way so you can live a fun, joyful life without always being afraid.
I don't know the skills I need to obtain to conquer this instance of the human condition, but understanding it at a deeper level I think is a step in the right direction.