Assalamualikum Warahmatullah Mufti Sahib,
الجواب وبالله التوفيق
Try to have a firm intention when you decide to do something. Remove such things from your life which are wasteful and have no significance here and hereafter. This way your attention would not even go to those things. Also make dua to Allah Subhanahu Wa Ta‘ala for the power and steadfastness to refrain from such things.
واللہ اعلم بالصواب