Do you mean shuts off or goes to sleep?
Have you checked your Power options in the control Panel under System and Security
Not being funny but is your charger plugged in when this happens or is the battery fully charged
Does this happen when you close the lid? There are options to shut down your laptop when you close the lid?
Like stated in the previous post,more information would be helpful in a solution to your problem