Change Auto-Lock time
If you leave your iPhone for a certain amount of time, it automatically gets locked and goes to sleep. The Auto-Lock time on the iPhone, which is set to 1 minute by default, can be changed to your preference from 30 seconds to 5 minutes, or "Never".
Open the "Settings" app

On the Home screen, tap "Settings".
Tap "General"

Then, tap "General".
Tap "Auto-Lock"

Tap "Auto-Lock" under the General section.
Change Auto-Lock time

Tap on your preferred time period to place a checkmark on it.
Incidentally, if you enable iOS 9's new Low Power Mode, it sets the Auto-Lock time to 30 seconds.
Auto-Lock time on iPad
As for the iPad, there are five options available for choosing the Auto-Lock time period: 2 minutes, 5 minutes, 10 minutes, 15 minutes and Never.