We know that in general the stronger the Iman is the lesser calamities someone has. Does this include waswas? Meaning that the smaller the amount of sins, the smaller the amount of waswas. Are large quantities of waswas punishment for sins? In other words the more good deeds we do and the lesser sins we do, this will cause the waswas to decrease the quantity of evil they contain and intensity and frequency. And the more bad deeds we do and lesser good deeds we do, this will cause the waswas to increase in quantity of evil they contain and intensity and frequency.
1 Answer
Your questions about waswas overlap with many areas of inquiry. A real answer has to take into account not just religious doctrines but also possible physiological and psychological factors. In that sense they are at least partly off-topic here except if we adopt the view of a particular brand of Muslim holistic polymath scholars who believe that for full knowledge of Islam as a comprehensive guidance of life one needs to master many traditional and modern scientific fields too or more viably draw upon definite findings of specialists in those relevant fields. Such is not how Islam and it scholarship is understood in most contemporary seminaries, though.
My answer would be only an attempt to an comprehensive approach like that.
Waswas can result in from physiological, psychological and ethical causes.
In Ibn Sina humeral medicine, the physiological cause is usually black bile excess in the brain. Treatments therefore would involve food or medicine that reduce black bile in the overall body chemistry or brain chemistry in particular. In modern medicine though it can be very much more complicated as compulsive behavior doesn't yet have any definite cure and the causes remain largely unknown and prescriptions usually involve anti-depressants that can have severe side effects. At any rate, we are not supposed to offer any particular medicine on an online website. But in traditional humeral medicine there are harmless natural remedies that can be very effective that are safely recommendable in absence of personal diagnosis: sweet fruits like apples, peach and mango usually have remarkable impact on a number of psychological problems emanating from brain conditions including compulsive behavior, waswas.
Physical exercise, good relationships, happiness, i.e. whatever triggers positive energy in the body and improves blood circulation are also very helpful.
On the psychological side, things and experiences that induce a lot of stress can the be original cause or a worsening factor. So one should avoid stressful things until health is restored.
From the religious view, sins can play a role for a number of reasons: certain sins mess with neurological and hormonal health: drinking, excessive and abnormal sexual indulgence, unIslamic attitudes like contempt, jealousy and anger. These attitudes are proven to have bad influence on health in modern medicine. In traditional medicine they are responsible for production of excess black bile that causes mental health problems.
In religious context though these results can be seen as "punishment" for sins. Indeed they these negative attitudes can be said to result from unIslamic worldview: envy for example is dissatisfaction with how Allah has favored His other creatures and lack of faith in how Allah compensates the less gifted individuals in Janna should they undertake qina'at in life: satisfaction with basics of life or even lower than basics hence not craving for possessions of the better gifted fellows.
Envy can also be a result of wrongful evaluation of success for Iman and right deeds are considered the highest wealth in Islam, whereas envy are usually directed towards worldly possessions. A Muslim doesn't put overdue emphasis on worldly advantages against virtues of Iman. Therefore a deepened or strengthened faith in Allah can help eliminate unhealthy attitudes that result in the health defects in question.
Doing good deeds can have positive impact but they are more likely if the good deeds are part of greater balanced Islamic way of life. For example doing charitable things for others can be helpful BUT if they are motivated by a genuine sense of compassion for fellow humans. But if we feel we are somehow over-exerting ourselves to do generous things, this can actually backfire as it would introduce more stress to our mind directly or indirectly.
Praying and doing nawafil are good but again if bad health conditions makes performing extra prayers burdensome, we would not be able to perform a really sound prayer since we would lack focus and peace during prayer. And again if we too much exert ourselves to doing the prayers anyway, it will introduce more stress negatively affecting our health even if we are rewarded for our good will in hereafter. That can be said is why Allah didn't make nawafil obligatory for Muslims when He made it obligatory for Prophet Muhammad (pbuh).
Among generally good deeds, fasting can also be counterproductive as it dehydrates the body negatively affecting blood supply for the brain hence exacerbating mental health, waswas in particular. A reason for the general exemption for sawm granted to patients in Islam.
Finally a general recommendation for compulsive behavior recommended in particular by Islamic sources is simply ignoring the wasawis or doing dhikr. This recommendation though like I said is general and doesn't address the possible physiological conditions/causes that are usually associated by a prolonged compulsive behavior. That's why I dedicated most of my answer to the physiological aspect.
Wa huwa yashfeen...