The Messenger of Allah (peace and blessings be upon him) said: “Whoever drinks alcohol and gets drunk, his prayer will not be accepted for forty days and if he dies he will go to Hell. But if he repents, Allah will accept his repentance. If he again drinks alcohol and gets drunk, his prayer will not be accepted for forty days and if he dies he will go to Hell. But if he repents, Allah will accept his repentance. If he again drinks alcohol and gets drunk, his prayer will not be accepted for forty days and if he dies he will go to Hell. But if he repents, Allah will accept his repentance. If he commits (this sin) again, then Allah pledges to make him drink the mud of khabaal on the Day of Resurrection.” They asked, “O Messenger of Allah, what is the mud of khabaal?” He said, “The juices of the people of Hell.” 

Classed as sahih (authentic) by al-Albaani.

The above punishment is for the one who drinks alcohol and dies without making sincere repentance to Allah. This means that if after drinking alcohol one regretted the act and resolved not to do it against and asked Allah for forgiveness, the sin and the punishment for drinking will be removed.

Elaborating more on your question, we’d like to cite for you the following fatwa issued by Sheikh M. S. Al-Munajjid, a prominent Saudi Muslim lecturer and author, who states:

“There are many sahih hadiths concerning the punishment for one who drinks alcohol, which say that his prayers will not be accepted for forty days. This was narrated from ‘Amr ibn al-‘Aas, Ibn ‘Abbas, Ibn `Umar and Ibn `Amr. 

One of these hadiths was narrated by `Abdullah ibn `Amr who said: The Messenger of Allah (peace and blessings be upon him) said: “Whoever drinks alcohol and gets drunk, his prayer will not be accepted for forty days and if he dies he will go to Hell. But if he repents, Allah will accept his repentance. If he again drinks alcohol and gets drunk, his prayer will not be accepted for forty days and if he dies he will go to Hell. But if he repents, Allah will accept his repentance. If he again drinks alcohol and gets drunk, his prayer will not be accepted for forty days and if he dies he will go to Hell. But if he repents, Allah will accept his repentance. If he commits (this sin) again, then Allah pledges to make him drink the mud of khabaal on the Day of Resurrection.” They asked, “O Messenger of Allaah, what is the mud of khabaal?” He said, “The juices of the people of Hell.” 

Classed as sahih by al-Albani. 

The fact that his prayers are not accepted does not mean that they are not valid, or that he should give up praying, rather it means that he will not be rewarded for them.

So the benefit of praying will be that he will have discharged his duty and will not be punished for not doing it. 

Abu `Abdullah ibn Mandah said: The words “his prayer will not be accepted” mean that he will not be rewarded for his prayer for forty days, as a punishment for his drinking alcohol, just as they say that the one who speaks on Friday when the imam is delivering the khutbah should pray Jumu`ah but there is no Jumu`ah for him, meaning that he will not be given the reward for Jumu`ah as a punishment for his sin. 

Ta`zeem Qadr al-Salaah, 2/587, 588.

Al-Nawawi said: 

With regard to his prayer not being accepted, what this means is that he will not be rewarded for it, even though it is valid in the sense that he has discharged his duty and does not need to repeat it. End quote.

No doubt the person who drinks alcohol still has to perform the prayers on time. If he were to delay any of his prayers, he would be committing a grave major sin, which is worse than the sin of drinking alcohol.

This punishment for drinking alcohol applies to the one who does not repent. But if he repents to Allah and turns to Him, He will accept his repentance and accept his good deeds, as it says in the hadith quoted above: “… but if he repents, Allah will accept his repentance.” And the Prophet (peace and blessings be upon him) said: “The one who repents from sin is like one who did not c
ommit sin.” (Narrated by Ibn Maajah)

Having given the above, it becomes clear that the punishment mentioned in the hadith applies to one who drinks alcohol and dies without making sincere repentance. That is why we urge you, dear brother, to fear Allah and to stay away from drinking alcohol. You should immediately stop drinking and make sincere repentance to Allah to forgive your sin and to guide you and us to the right path. While speaking of repentance, we must hasten to add that repentance cannot be considered valid unless one takes the following steps:
First, one must feel deep remorse for the sins he has committed.
Second, one must refrain from the sin totally while also abstaining from all those leads or circumstances that led him to such a sin in the first place.
Third, one must be firmly resolved never to sin again and immediately become occupied in whatever good deeds that he can in order to wipe out his past sins.
all of the above involve sins involving the rights of Allah. If, however, one’s sins involve the rights of human beings, then he must also do whatever it takes to return, compensate or redress the grievances of the person he has wronged. Paying him his dues or compensating him in whatever ways possible becomes an essential condition of valid repentance.
Once repentance is accomplished as described above, your sins will be undoubtedly wiped out and you are guaranteed a clean record. The Prophet (peace and blessings be upon him) said, “One who has repented of a sin (sincerely) is like one who has never sinned at all.”