I believe that part of what can trigger that feeling is the input overload of our society. My son has Aspergers (austistic spectrum) and the lights, noise, sensations of touch, smell, etc...are like on super blast....like being at a carnival and never getting to go home to unwind from the stimulation.
We are inundated with 'reality' TV, media, etc....where 'real' emotions have been mimicked so much that wen we experience them, we wonder who may be 'watching' and not in a paranoid sense, but what you have described..this unrealness..this 'what if I'm just a character in a book or show or something" They even have the movie with Jim Carey - The Truman Show...where his whole life was staged.
My 'grounding' myself has come by limiting my exposure to all this other 'noise'. To simplify. Did you know that just ONE PAGE of the Wall Street Journal has as much information on it that someone living just 100 years ago would find out in a lifetime?? And look at what we have...constant barrage.
I'm not saying to isolate yourself. I'm saying, give yourself some peace from the stimulation and see if it helps. And in the meantime, during a feeling of unrealness...just remember...unreal people don't wonder if they're real.

What was it the philosopher said? "I think...therefore, I am." And I know - maybe you know for sure you are real..but wonder if you can trust your surroundings to be. I suppose, I would just tell myself...if this was all in my head...I'd have made my flowers grow brighter...or,if still not convinced, how about I will choose to enjoy it, then, while it lasts...then, at least, it's not depressing or something to fear.