What to Recite When Someone Is Dying
Question

I read in the answer to question no. 21870  that is it prescribed for those who are present with a dying Muslim to recite Surat Yasin for him, because it makes it easier for the soul to depart. Is there any evidence for that?
Praise be to Allah.The majority of scholars (including the Hanafis, Shafi`is and Hanbalis) are of the view that it is mustahabb to recite Surat Yasin in the presence of one who is dying , and they quoted a number of things as evidence for that, but the evidence is not free of some weakness. 
Ahmad (19789) and Abu Dawud (3121) narrated that Ma’qil ibn Yasar (may Allah be pleased with him) said: The Prophet (peace and blessings of Allah be upon him) said: “Recite Yasin for your dying ones.” 
This hadith is weak and was classed as such by al-Nawawi in al-Adhkar. Ibn Hijr said in al-Talkhهs (2/104): “Ibn al-Qattan described it as weak because there is some problem with it and it is mawquf, and because the status of the narrator Abu 'Uthman and his father is unknown. Ibn al-‘Arabi narrated from al-Daraqutni that it is a hadith whose isnad is weak and whose text is unknown elsewhere, and there is no sahih hadith on this topic.”  
It was also classed as weak by al-Albani in Irwa al-Ghalil (688). 
Ahmad (4/105 and 16521) narrated that Safwan said: The shaykhs told me that they were present with Ghudayf ibn al-Harith al-Thumali (a Sahabi) when his death throes grew intense. He said: Is there anyone among you who can recite Yasin? Salih ibn Shurayh al-Sakuni recited it and when he reached the fortieth verse, he passed away. The shaykhs used to say: If it is recited in the presence of the dying person, he finds relief thereby. Safwan said: ‘Isa ibn al-Mutamari narrated it in the presence of Ma’bad. 
Al-Hafiz said in al-Isabah (5/324): its isnad is hasan. (See also: al-Majmu’ (5/105); Sharh Muntaha al-Iradat (1/341); Hashiyat Ibn ‘Abidin (2/191). 
This view was favoured by Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him), who said in al-Ikhtiyarat (p. 91): 
“Reciting Quran over the deceased after he has died is a bid’ah (innovation), unlike reciting for the one who is dying, when it is mustahabb to recite Yasin.” 
They said: the reason why it is mustahabb to recite it is that this surah includes mention of Tawhid and the Resurrection, and the glad tidings of Paradise for the one who dies believing in Tawhid, as Allah says (interpretation of the meaning): “Would that my people knew that my Lord (Allah) has forgiven me” [Yasin 36:26-27].  So the soul is comforted by that and it is easier for it to come out. (See: Matalib Uli al-Nuha, 1/837) 
Imam Malik (may Allah have mercy on him) was of the view that it is makruh to recite Surat Yasin or any other surah in the presence of the dying person, because of the weakness of the hadith which speaks of that, and because it was not what people did.
See: al-Fawakih al-Dawani (1/284); Sharh Muhtadar Khalil, 2/137. 
Shaykh al-Albani said in Ahkam al-Janaiz: 
“With regard to reciting Surat Yasin in the presence of the dying person, and turning him to face the qiblah, there is no sahih report concerning that.” 
Shaykh ‘Abd al-‘Aziz ibn Baz (may Allah have mercy on him) was asked: Is it permissible to recite Surat Yasin when a person is dying? 
He replied: 
“Reciting Surat Yasin when a person is dying is mentioned in the hadith of Ma’qil ibn Yasar, according to which the Prophet (peace and blessings of Allah be upon him) said: “Recite Yasin for your dying ones.” It was classed as sahih by several scholars who thought that its isnad was jayyid and that it was narrated by Abu ‘Uthman al-Nahdi from Ma’qil ibn Yasar. Others classed it as da’if and said: the one who narrated it is not Abu ‘Uthman al-Nahdi, rather it is another person who is unknown. What is well known about the hadith is that it is da’if because nothing is known about Abu 'Uthman. So it is not mustahabb to recite it for the one who is dying. The one who said that that is mustahabb thought that the hadith was sahih, so he described it as mustahabb. But reciting Quran in the presence of one who is sick is a good thing, and Allah may benefit him through that. But with regard to singling out Surat Yasin, the basic principle is that the hadith is da’if (weak) so there are no grounds for singling out this surah.” (Fatawa Ibn Baz, 13/93)
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) was asked: Is reciting Surat Yasin for one who is dying proven in the Sunnah or not?
 He replied: 
“Reciting Surat Yasin for one who is dying is Sunnah according to many scholars, because the Prophet (peace and blessings of Allah be upon him) said: “Recite Yasin for your dying ones.” But some of the scholars spoke about this hadith and said that it is da’if. According to those who classed it as sahih, reciting this surah is Sunnah, and according to those who classed it is da’if it is not Sunnah. And Allah knows best.”  (Fatawa Ibn ‘Uthyamin, 17/72) 
He also said: 
“Recite Yasin for your dying ones” – this hadith is weak and there is some weakness in it. If the hadith is sahih, the time for reciting it is at the time of death , when the death-throes begin; that is when Surat Yasin may be recited for him. The scholars said: There is some benefit in it, which is that it makes it easier for the soul to come out, because in it Allah says (interpretation of the meaning): 
“It was said (to him when the disbelievers killed him): ‘Enter Paradise.’ He said: ‘Would that my people knew
 ‘That my Lord (Allah) has forgiven me, and made me of the honoured ones!’” [Yasin 36:26-27]
So this may be recited in the presence of the one who is dying if the hadith is sahih, but there is no basis for reciting it over the grave.” (Fatawa Ibn ‘Uthaymin, 17/74)
And Allah knows best.