Consider the destruction this conduct brings to you physical and spiritual life. To correct the past failures: Increase words of Torah and Tefillah. Know orally Mishnayos , Tanya, vehodarto. The memory of the holy words of Torah will chase away the negative thoughts.
https://www.torahrecordings.com/rebbe/igroskodesh/009/013/2898