From googling, the power button stopped working appears to be a common issue for the Lumia series, and it's an issue for all the side buttons (power/lock, volume and camera keys)
A quick and dirty way to "fix" the issue is demonstrated by this Youtube video: https://www.youtube.com/watch?v=rLpmEPqE668 . Basically, you cut a thin plastic and slide it into the gap right on top of the button to reduce extra movements.
At least for me, that works. Though unsure of how long the fix might last, I also opt to follow some of the advice I find in forums to reduce my usage of the power button. (https://answers.microsoft.com/en-us/winphone/forum/wp8-wpupdate/lock-button-on-nokia-lumia-520-not-functioning/6bf1d443-782d-447c-8b4f-f2314e580439)
For turning the device on, you can change your phone setting so double tabbing the screen will turn the device on: Settings -> Touch -> "Wake up::Double tap screen to wake up the phone".
For turning the device off, you can do so with an app. I use Lock Screen by "Baby Dragon", and put the power off app icon on the right side near the power button. So instead of using the physical power button, I would just hit the Lock Screen app icon instead.
If you have the time, you should do a search and see if you can find an alternative lock screen app that uses fewer permissions. For Lock Screen, it "requires" music library, media playback, data services, movement and directional sensor, and web browser component. I don't know why it would need access to my music library.