Turning off or restarting iPhone if lock button is broken?
You have a couple options:


Simply let the phone discharge until it turns off. Then, you can charge it again and it should turn on when it reaches a high enough battery level.
If you dare, you can reset the device's network settings which will restart it (but obviously, also clear your network settings).
You can use Assistive Touch (Settings > Accessibility) to lock and turn off the phone.


But really, you should take it into an Apple store, so they can deal with the underlying problem of your broken button!