Re: Handling a critically sick friend.
Masha'Allah. May Allah (swt) bless him with health soon, Ameen! Btw I am sure he already knows it, but just for raising his moral, tell him that whenever a person gets ill, due to which he isn't able to do those good deeds that he used to do in usual days (of good health) Allah (swt) orders the angels to continue writing all those good deeds in his account everyday. Even though he is not able to do them now but he would continue to get sawab of all of them. Tahajjud prayers, helping poor, doing zikr, keeping roza, serving his parents and relatives, learning and reciting Quran and Hadith...everything.
He is lucky to have his healthy days spent in a good manner, because such time in the hospital are very difficult, painful and full of guilt for those who waste there healthy days. BUT still it is a chance for everyone to repent (and hence get all his sins forgiven) in order to start a new beginning. As mentioned in a hadith. Make use of five before five:
Your healthy days before your sickness/illness days
Your spare time before you get too busy
Your youth before your old age (when you won't be able to perform those energetic good deeds that were possible only in times of youth)
Your rich days before you become poor
Your life before your death.