Hazrat Mufti Ebrahim Salejee (Daamat Barakaatuhu) mentioned:
When Shaitaan was rejected, he vowed to Allah Ta‘ala that on account of him misguiding man, very few would be grateful. When a person has the quality of gratitude, then he will always obey the one who was kind to him.
In order to harness this quality, do four things: (1) Think of your humble beginnings and how Allah Ta‘ala enabled you to progress. (2) Admit that it is Allah Ta‘ala alone who does everything and that all that we have is from Him. (3) If you have something that is pleasing to you then say: “Mashaa Allah” i.e. it is only through the will of Allah Ta‘ala that I have received this. (4) Don’t think that it will last and remain with you forever. Rather, it is subject to the will of Allah Ta‘ala.