Chosen Solution
I have a PS4 i bought Refurbished from Gamestop worked great for the first to years Now when it comes on i have to put it in sleep mode because if it turns off i end up having to leave it unplugged for hours or in some cases days To get it to come back on. It can also sometimes randomly turn off
Sounds like a overheated power supply from dust build up. I would start with getting that replaced first. On which power supply model to get, refer to model number printed under power supply casing (ADP-xxxx) PlayStation 4 Power Supply Replacement
this type of behavior is usually down to the system protecting itself from overheating. I’d start by checking the vents to see if there is much dust, dirt and debris in there, if so follow one of the teardowns and clean up as much as you can.