Touch Screen timeout and select the time of inactivity before your phone sleeps.
Use Screen attention to keep the screen on when you're looking at it and turn it off when you look away:
In certain lighting conditions, your phone may have difficulty detecting when you've looked away.
To turn Screen attention on:
Go to Settings > Display > Screen timeout.

If you don't want to use Screen attention, then turn it off 