Muhammad b. al-Ash’ath, one of the offspring of al-Ash’ath b. Qays al-Kindi, narrated from ‘Ali b. al-Hakam from ‘Abd Allah b. Bukayr from Zarara b A’yan, who said: A son of Ja’far b. Muhammad al-Sadiq, peace be upon him, was ill during the lifetime of Abu Ja’far, peace be upon him. Ja’far was sitting in a corner of the room and the boy was in the agony of death. Whenever anyone came close to him [the boy], he said: “Do not touch him, for his weakness will increase. A patient is at his weakest when he is in this condition, so whoever touches him makes him weaker.” When the boy died, he gave instructions about bim and the boy's eyes were closed. Then he said to us: “Sadness and distress and grief are only as long as Allah's command has not been revealed. When Allah's command is revealed, then there is nothing but submission and acceptance.”
Then he called for oil and anointed himself and applied al-kuhl around his eyes. He called for food, and he and those with him ate together. Then he said: “This is the sweet patience (12:18) in which we were promised excellence. Allah, the Exalted, has said: Upon those rest blessings and mercy from their Lord, and those— they are the truly guided (2:157). Then he gave orders concerning him (the boy] and he was bathed. He [al-Sadiq] dressed in his finest clothes and went out to pray over him."
From Abu ‘Abd Allah al-Sadiq, peace be upon him, that he said; ‘There is not one who is about to die but that Satan assigns to him one of his demons to call him to disbelief and make him doubt his charge and his religion until his soul departs. He [the demon] will not have any power over whoever is an enlightened believer, declaring the unity of Allah. He will make whoever is weak in his religion doubt his condition and his religion. So, when you are present with those about to die instruct them to recite the declaration of sincerity, and it is: “There is no god but Allah, the Most High, the Mighty. There is no god but Allah, the Clement, the Noble. Glory be to Allah, the Lord of the seven heavens and the Lord of the seven earths, and what is in them, and what is between them, and what is under them, and the Lord of the Mighty Throne. Praise be to Allah, the Lord of the Worlds.”’
He said: Al-Mu’alla narrated from Ahmad b. ‘Isa from Ibrahim b Muhammad from Ahmad b. Yusof from Abu ‘Abd Allah al-Sadiq, peace be upon him, that he said: ‘When a believer who is a stranger is about to die, he turns to the right and the left and, seeing no one, raises his head to the heavens. Then Allah, the Mighty and Sublime, says, “My servant and my friend, to whom do you turn? Do you seek a friend or a relative closer to you than Me? By My Power and My Majesty, if I loosen your bond, I will surely cause you to worship Me, and if I hold you to Me, I will surely bring you to my Magnanimity and into the proximity of your friends and loved ones.”’