In addition to the power saving mode, you can try to turn off the Bandwidth Saver. If your device is streaming for four hours where no commands are received from your Roku remote or the mobile app, the Roku platform interprets this as inactivity on your Roku device. After those four hours, your Roku device will display a prompt asking you to confirm that you are still watching. If there is no command, it will go exit and go to the main menu.
The YouTube app may also have something built into its settings that also do something similar. You can look in the YouTube app to see if there are any inactivity/sleep settings as well.