1) Check your settings and see if you have a quick timeout to auto-lock. The shortest time is 2mins up to never.
2) If the above doesn't help you try a hardware reset. Simultaneously press and hold down the home and power buttons until the screen goes blank and the Apple logo appears. Release the buttons when the Apple logo appears. You've reset the device and you don't lose any data.