It is highly likely due to CPU overheating. There is no reason to change the CPU. Just find a way to keep its critical temperature below 50 degrees centigrate.
1. Please open the box and check whether the fan attached to the CPU is still working. Even it is still working, it may need lubrication.
2. Leave the box open and use the PC and see whether it still shut down for no reason.
3. Please search on google for "Monitor CPU Temperature" for a freeware and download it.
Good luck and let us know the result.