I have read that the Prophet Muhammad, peace be upon him, used to get fever such that his body would be really hot. Fever erases sins so can I make dua that Allah gives me fever and headache to remove my sins?
No, never do this. Never ask Allah to punish you with sickness or any painful issue in this world. There is an authentic hadith saying that the Prophet peace be upon him called on one of his Companions who was ill and he found him in a very serious state of fatigue, he asked him: Do you make any special supplication?
The Companion replied: Yes, I asked Allah if I am to be punished in the hereafter, to make this punishment in this world instead.
The Prophet, peace be upon him, said: You will not be able to tolerate this, but instead you should say:
اللهم آتِنا في الدنيا حسنة وفي الآخرة حسنة، وقِنا عذاب النار
“Allahuma Atina fi adonia hasana wa fi alakhirati hasana wa qina adhab annar”, and he asked Allah to cure him, and Allah cured him.
The Sunnah is to make Istighfar and to make repentance and always ask Allah “Al Afeyah” goodness in health and in all aspects of you life. Like the dhikr we make in morning and evening adhkar.