Prophet (SAW)'s Prayers

When the soul is leaving the body
اللَّهُمَّ أَعِنِّي عَلَى غَمَرَاتِ الْمَوْتُ وَسَكَرَاتِ الْمَوْتِ
"O Allah, at this (time) of severity of death help me". (Tirmidhi)
At the time of death turn the face towards the Qibla and the Majlis (gathering) that is present should say the shahada
لَا إِلَهَ إِلَّا اللَّهُ
loudly in front of the dying person so that he may hear it and recite it. It is not fard or wajib to recite the shahada at the time of death and if someone did not recite it, then it makes no difference.
It is stated in hadith that if the following are the last words of a dying person then he will enter Jannah (i.e. he will be saved from the punishment of sins and there will be no barrier from entering Jannah).

(Hinsul Hasin)
During the last moments a person from amongst those present should recite Surah Yaseen (as it eases death).

(Hisnul Hasin with Marginal notes)