What to check
Note which event happens, the game, any code and whether the unit restarts by itself.
What your result tells you
An application crash and a power cut give different starting points. Accurate timing helps reproduce the correct symptom.
Manufacturer troubleshooting and reference
Get help with this issue
PlayStation shutting down during games