I broke the flex cable that connected the power button to the phone's motherboard. I tried a couple of applications in PlayStore that let you put the phone in sleep mode using a single tap but annoyingly, they show ads. This is a simple app that allows you put the phone in sleep mode using a single tap. It does not show any ads, collect any data and never runs in background.
aniketbhatnagar/PowerButtonFree
Simple android app that puts the phone in sleep mode on a single tap
Java