Restore iphone 5 with broken wake/sleep button
Follow Apple Support's guide for what to do if you forgot the passcode on your phone: https://support.apple.com/en-us/HT204306 

You shouldn't need the sleep/wake button for this. Once you get your iPhone unlocked with the help of that article, turn on "AssistiveTouch" in Settings->General->Accessability so you can sleep your phone again.