Thanks for using Apple Support Communities.
Apple's published guidelines for a period of ONE (1) YEAR from the date of original retail purchase by the end-user purchaser.
For more information on this, take a look at this article:
Best of luck,
A lot of people are having this issue. Take it into an Apple store and they'll replace it free of charge but I have to warn you, A LOT of phones are like this and the chances you get a replacement with another lock button issue is pretty high. I've had to have mine replaced 5 times and the current one still has its own issues.