The auto shutdown was probably due to your PS3 temperature, which is too hot. This can be caused by several things, but the most common ones are the cooling fan isn't working/having problem due to dust, or the thermal paste on your PS3 has dried out.
Try clean your PS3 first, and change its thermal paste (you can use the ones for PCs), then see if there's any changes. If there isn't, then it probably due to HDD problem, which you must replace it with a new one.
Also, if there's no game that you don't want to play in the PS3, then I suggest that you buy a PS4. Because PS3 is pretty much has been abandoned by almost all gaming devs, which has jumped to PS4/XB1/Switch.