To set an Android phone to never sleep, you have to enable Android’s hidden Developer options, then in the Developer Options, which appear in the Settings after enabling them, tick the box to Never Sleep While Charging.
❗ Note: At this point, there is no way to set Android to never sleep, except while charging.