Use the built-in iPhone sleep timer
Tucked away in the Clock app that ships with the iPhone is a Timer feature. When the timer finishes, the default action is to play a ringtone, but by tapping the "When Timer Ends" button, you can change this behavior to "Sleep iPod."