Another way to lock your iPhone screen is if you go into Settings > General > Accessibility and enable Assistive Touch, a new transparent button appears on your iPhone. This button can be accessed all the time. It is overlayed over anything appearing on your phone. If you tap it, and then tap Device, one of the options is Lock Screen.