Check if your device is heating up, if not check for any malicious app on you device.If you are using Ram Plus that can also cause this problem. This also happened with my device. When i add more than 4GBs of Ram, the phone sometimes restarts automat...
You can use "Secure Folder" to keep your files and pictures locked. If Secure Folder is not available on your device then go to Google Play Store and download the app called "Vault". It's one of the best app to keep your files locked.