What to Do When You Are Losing Faith in Islam
Question

I have been a religious person for several years, but for a few months I have been feeling that my mind and heart are devoid of faith and will power. This matter is tormenting me and I said to myself that perhaps this is a touch from the devil or something like that, and it will go away when Ramadan comes. But it has not gone away and I find it very difficult to pray Qiyam Al-Layl (night prayers).
I have tried to read more Quran despite these insinuating whispers and the distress it is causing me. My situation has started to affect me socially, at work, in the family and in my religion. 
Now I am living in torment because of this and I cannot find the faith which I feel has been taken away from me. I feel that I will have a bad end and that my faith will never return to me and that a seal has been placed over my heart. When I go to the mosque to pray, which I have not stopped doing, I feel that I am not like the other worshippers and I envy them for their faith. I also feel put off by religion and often I cannot listen to the Quran or Hadith (prophetic narrations), or listen to tapes, except with great difficulty. 
This is tormenting me because I do not want this, and I want to be like I was, a believer who loves the religion because it is the truth, but I feel that I cannot control my mind or my feelings. I have started to think about my sins which I believe are the cause of this, and I have started to remember many sins which I had forgotten, as if they are appearing before me one after the other.
Until now I am living with this torment, misery and distress. I do not know what has happened to me and what the solution and the remedy is. Will my faith come back to me or is this a bad end and a punishment from Allah? 
Finally, please do not forget to make Du`a (supplication) for me.
Praise be to Allah.My brother, have great hope in Allah, and do not let the devil cause you to despair of the vast mercy of Allah which He has guaranteed for His believing slaves. What you are telling yourself about this being a sign that you will die following something other than that which Allah wants is only insinuating whispers (Waswas ) from the devil and his deviant ideas by means of which he wants to tempt the slaves of Allah and lead them away from their religion. 
So he comes to a righteous slave and whispers to him that his good deeds are of no avail, or that he is doing them not for the sake of Allah but to show off to people, so that they will think he is good.
 All of these are the usual ways with which the devil tries to trick the slaves of Allah, especially those who show signs of being righteous – of whom I think that you are one, although I do not praise anyone before Allah – to hinder their efforts. We seek refuge with Allah from him. 
You need to increase your hope and trust in Allah Who forgives all sins, and who accepts the slave who seeks His protection and refuge, for He is the Most Merciful, the Oft-Forgiving and the Most Loving.  
You should increase your good deeds , such as reading the Quran, giving charity , remembering Allah (Dhikr ), upholding the ties of kinship, etc. 
The weakness which you feel also happens to others, for it is something natural. How many people were examples followed by others and had a great deal of drive and ambition, then they lost their drive and ambition for a long time, then it came back to them by the grace of Allah. 
Remember the words of the Prophet (peace and blessings of Allah be upon him): “Everybody has his time of energy, and every time of energy is followed by a time of lethargy. But if a person tries to follow a moderate path, then I have hope for him, but if he becomes one who is pointed out (in the street), then do not think anything of him.” (Narrated by At-Tirmidhi, 2453; classed as sound by Al-Albani in Sahih At-Tirmidhi, 1995) 
What is meant by “Everybody has his time of energy” is eagerness for a thing, energy and the desire to do good.
What is meant by “every time of energy is followed by a time of lethargy” is tiredness, weakness and lack of movement.
“But if a person tries to follow a moderate path” means that the one who has energy does his deeds in moderation and avoids going to extremes when he is feeling energetic and avoids being negligent when he is feeling lethargic.
“Then I have hope for him” means, I have hope that he will be successful, for he can continue following a middle course, and the most beloved deeds to Allah are those which are continuous.
“but if he becomes one who is pointed out (in the street)” means, if he strives hard and goes to extremes in doing good deeds so that he will become famous for his worship and asceticism, and he becomes famous and people point him out to one another,
“then do not think anything of him” means, do not think that he is one of the righteous, because he is showing off. He did not say, “do not have hope for him,” as an indication that he has already fallen, and he will not be able to make up for what he has missed out on. [Tuhfat Al-Ahwadhi] 
Think about this Hadith, and relate it to your own situation and the situation of others: you will see a clear similarity. This Hadith clearly states that man goes through a stage of incomparable eagerness and great focus and ambition, then suddenly he becomes weak and loses that focus and eagerness and ambition. When he reaches this stage, he must strive even harder to do obligatory duties and avoid prohibited things. If he does that, then there is the hope that he will succeed and progress, but if he falls into prohibited things and stops doing obligatory things, he will be lost and doomed.
So you must turn to Allah a great deal, seek His forgiveness and ask Him to make you steadfast until death. I also advise you to keep away from prohibited things. May Allah forgive your sins and make things easier for you.
For more details, please see the following answers: 9356 , 10776 , 14041 , and 223615 .
And Allah knows best.