Either it is overheating, or sensor is broken, and the firmware is shutting down the Mac thinking it is protecting it from burning itself out.
Make a Genius Bar appointment at your local Apple store, or an authorized Mac repair facility and have the hardware checked out.