The only way to be clean of heart is to keep the Word of God because it can help us in the most difficult moments, keep us from all the bad things that want to gnaw and enter and cause a total mess in our hearts.
That is why we must remain pure and always holy before God, praying to the Lord to give us strength to overcome temptations. This will help us enough to know everything that is sent by the evil one to make us sin against God.
Wherefore, beloved, seeing that ye look for such things, be diligent that ye may be found of him in peace, without spot, and blameless.
2 Peter 3:14