A couple of things you can do. First reset the SMC. That can help with sudden shutdowns.
If the sudden shutdowns might be thermally-related, run the Apple Hardware Test, in extended mode, which may take over an hour to run. This will check that the fans and sensors, amongst other hardware, are working correctly.
Load the Activity Monitor (In Launchpad, utilities or on the hard drive in applications/utilities) and watch the CPU usage for any program driving the CPU to be consistently busy.
Do you get the same results if you do a safe start, by rebooting and holding the shift key down? If not, look at your login items (in System Preferences, users) as something loading there may be misbehaving.
Reset the SMC by following these steps:
- Shut down the computer.
- Plug in the MagSafe power adapter to a power source, connecting it to the Mac if its not already connected.
- On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
- Release all the keys and the power button at the same time.
- Press the power button to turn on the computer.
Note: The LED on the MagSafe power adapter may change states or temporarily turn off when you reset the SMC.
The number to look at is in the bottom left corner, where it says % idle. In both views it says the system is loafing along at greater than 90% idle. You should start to be concerned when you see a consistent 30% to 50% or more. So let Activity Monitor run in the background. Next time your system makes awful noises, look at it to see what the usage is. The goal is to see if some program or process is pushing your system to run hotter than it should.
So, you should still run the Apple Hardware Test as well as do a safe boot. To run the Apple hardware test, make sure you have an internet connection, restart your system, and
- Press and hold the D key before the gray startup screen appears. An Internet-enabled connection via Ethernet or Wi-Fi is required to use this feature.
- It takes a minute or so for Apple Hardware Test to start up and inspect your hardware configuration. While this is taking place, an icon appears on the screen:
- When the process is complete, select your language and click the right arrow. If you aren't using a mouse, you can use the up and down arrows to select a language and then press the Return key.
- The Apple Hardware Test console appears. You can choose which sort of test or tests to perform: To perform a more thorough diagnostic test, select the "Perform extended testing" checkbox under the Test button before you click the Test button.
Your test results will appear in the window in the bottom-right of the console. This test can take over an hour to run.