If PC goes to sleep, it abruptly turns off

Started noticing that when I would leave my room and come back my PC would totally shut off and I'd get error logs saying it shut off unexpectedly.

Today, I tried putting my computer to sleep and the screen immediately went black while the computer was still obviously running based on the RGB patterns and fan speeds. It was unresponsive when I tried to move the mouse or click keys on the keyboard to wake it up again. Then, it just popped off.

Any ideas? Is there any tools I can use to help diagnose what's happening when it tries to go to sleep?