Negative thoughts come from past exposure and investment in such avenues. You can use the intellect to
1. Keep yourself busy with your goal
2. Deflect thoughts away from the negative towards the higher, not necessarily God
3. Understand the futility of engaging in negative thoughts as it will result in bad consequences
4. Study the Bhagavad Gita on a daily basis. This is the most important thing that will help remove negativity with the powerful positive concepts of the Gita.