You can keep YouTube audio playing in the background on your iPhone by using the web app instead of the native app.
Here’s the steps as outlined by LifeHacker.
1. Start the video in the web app.
2. Press the home key once. This will exit Safari, and stop playback.
3. Double-tap the home key. This will bring up the dock (with all of your currently running programs).
4. Tap the dock with one finger and slide it to the right to reveal the background audio controls. There will be a single icon on the right side that corresponds to whichever program you last used with background audio – in this case, Safari.
5. Press the Play button. The audio from your YouTube video will resume playback, and you can then lock the phone (turn off the screen), switch to a different app, or do whatever you want, and it will continue playing in the background.