Hi. Are you sure your AC adapter is working? First try removing the battery if it's removable and run off the adapter. If that doesn't help, then check your adapter to see if it's working. Here's a great video.
It shuts off because it's losing power or over overheating. Do try to change your CMOS battery it could be one of the reasons it is shutting down. I did have the same problem once, by changing the batter my laptop is working in a great shape.