This tutorial will explain how you can prevent your PS4 from automatically turning off or going into rest mode.
If you haven’t done so already, head into the Settings menu.
From Settings, you need to select Power Save Settings.
Afterwards, select Set Time Until PS4 Turns Off.
You should then select Media Playback and then set it to Do Not Turn Off.
Next, select General Applications and then set it to Do Not Turn Off.
Your console should no longer automatically turn off or go into rest mode.