You've likely experienced the frustration that occurs when your iPhone can't decide which way is up. As you change sitting positions or lie down, it switches back and forth from portrait to landscape, regardless of whether you want it to stay in one place.
Stop this pesky screen rotation by first double-clicking the home button, which will display a list of recently opened apps. Swipe the list from left to right. This will reveal a set of music controls and a gray square with a circular arrow on the left. Tap that gray square and you'll see a message on the bottom that says "Portrait Orientation Locked." Your screen will no longer flip. Note that the screen cannot be locked into landscape mode, only portrait.