Surface Pro runs Windows OS, so basically, the process to troubleshoot this issue would be similar to, for any other Windows laptop. The way Surface works is that if you don’t use it for a few minutes, the screen turns off and Surface Pro goes into InstantGo power state, which can resume it very quickly. If you don’t use Surface Pro 3 for several hours, it will enter the Hibernation state. InstantGo in Windows replaces the Connected Standby of Windows 8. It maintains network connectivity when the screen is turned off, and it permits the system to update things in the background, and resume its job whenever required. All this is done primarily to save battery power So in effect, what it would mean, that when your Surface enters Hibernate, it subsequently shuts down.

Surface shuts down when I close the lid or click on Sleep

Here are few troubleshooting steps you may want to try if your Windows laptop or Surface Pro shuts down when you click on Sleep:

1] Update firmware & drivers

Ensure that all your device drivers are up-to-date.

2] Use default Power Plan

If you are using a Custom Power Plan, delete it and use one of the built-in standard Power Plan and see if the problem goes away. Restore default settings for that plan and see if it helps. Else change the power plan and see if that helps.

3] Run Power Troubleshooter

Run the Power Troubleshooter. It will detect your system settings that can affect power usages, such as timeout and sleep settings, display settings, and screensavers, and restore them to their default settings.

4] Disable Fast Startup

Open Control Panel > Power Options > System Settings, and uncheck Turn on fast start up. This worked in my case.

5] Troubleshoot further

Read this post if Hibernate shuts down the computer and see if something there helps you. If you need additional help, this post on how to troubleshoot Power Plans with PowerCFG Tool may guide you.