Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
How can we protect our minds from evil?
You can do this by directing them towards contemplating the majesty of Allah and our journey to Him, His bounties and His signs that are in His creation. Bestowing abundant prayers upon the Prophet Muhammad ﷺ will help in this.