For follow-up discussion and general commentary on the topic. Comments are sorted chronologically.
All of the above answers are very helpful. Even being a bishop of my church denomination I have struggled with this challenge of controlling my sinful impulses. Specially at night while in bed sinful thoughts have always troubled me.
Now I have started to read one chapter from the book of Proverbs while I am in bed. I have downloaded 'you version' Bible app. In my mobile phone. One good thing about the book of Proverbs is that it has 31 chapters, one chapter for every date in a month. I just read the chapter of the corresponding date, and as waiting for the sleep to overtake, I keep thinking about the verses and the teachings in that chapter. This has been helpful to me. One can try this.