How to Set a Sleep Timer on Your iPhone
You can set a sleep timer on your iPhone. If you like to fall asleep with music playing but don’t want to leave your iPhone playing music all night long, you can turn on its sleep timer.
Tap the Clock button on the Home screen.
Tap the Timer icon in the lower-right corner.
Set the number of hours and minutes you want the iPhone-as-an-iPod to play, and then tap the When Timer Ends button.
Tap the first item in the list, Sleep iPod.
Tap the Set button in the top-right corner.
Tap the big green Start button.