My girlfriends iPhone 4s lock button died and it was no longer in warranty. Software workaround was available from the iOS Assistive touch menu, but I wanted to try and fix it for her.
Was able to crack open the iPhone quite easily and replace the screws. I inserted a thin strip of plastic between the edge of the phone under the lock button and the ribbon cable above the camera which connects to the lock button. Took a lot of fiddling with, but finally got it working. Saw this approach in a YouTube video.
If you're not yet ready to dive into the full lock button replacement (spoiler alert: it involves significant disassembly of the iPhone), try slipping some material under the button. It's a little wonky but if you play with it you can get to work!