Based on your description it sounds like your phone is randomly restarting. I don't know of anyone else who has reported this problem, so it might be isolated to your phone.
If so, we can try to figure out whether it's a software or hardware problem. You can try factory resetting your phone to see if it's a software problem. Sorry, I know it's annoying to factory reset...
If after a factory reset your phone still restarts randomly, it's very likely there's some hardware issue causing the random restarts. Could be a faulty battery or something. If that's the case, you would probably want to see if it can be checked out by Google. You never said what model phone you're using, but if you're still having issues, I hope you can have it checked out while it's under warranty.