Short answer
He was 63. Revelation began when he was 40, he then lived 13 years in Makkah and 10 in Madinah, and he passed away in Madinah in Rabi al-Awwal 11 AH (632 CE), on a Monday.
The accepted Sunni account, from Ibn Abbas, Aisha and Anas in Bukhari and Muslim, is that the Prophet ﷺ died at 63 lunar years. A few reports give 60 or 65, but scholars explain them as rounding or counting differences.
The four schools agree on this.
Explanation
The Prophet ﷺ was born in Makkah in the Year of the Elephant, around 570 CE. Revelation came to him at the age of 40 in the cave of Hira. He called people to Islam in Makkah for 13 years, emigrated to Madinah, and lived there for 10 years. That makes 63.
He passed away in Madinah on a Monday in Rabi al-Awwal 11 AH, in June 632 CE, in the room of Aisha. The day of the month most often given is the 12th, though historians list other dates too. He was buried in that same room, which is now inside al-Masjid al-Nabawi.
Sahih Muslim also records that Abu Bakr and Umar both died at 63, the same age as the Prophet ﷺ. Ages here are in lunar (Hijri) years, which are about eleven days shorter than solar years, so 63 lunar years is about 61 solar years.
Some reports say 60, dropping the extra years, and one says 65, counting the years of birth and death. Scholars such as Ibn Hajar explain these and keep 63 as the sound figure. For his last days, read Last Words of Prophet Muhammad ﷺ and His Final Days. For his whole life, see Prophet Muhammad ﷺ.
The evidence
Quran, Surah Aal-i-Imraan 3:144
وَمَا مُحَمَّدٌ إِلَّا رَسُولٌۭ قَدْ خَلَتْ مِن قَبْلِهِ ٱلرُّسُلُ ۚ أَفَإِي۟ن مَّاتَ أَوْ قُتِلَ ٱنقَلَبْتُمْ عَلَىٰٓ أَعْقَٰبِكُمْ ۚ وَمَن يَنقَلِبْ عَلَىٰ عَقِبَيْهِ فَلَن يَضُرَّ ٱللَّهَ شَيْـًۭٔا ۗ وَسَيَجْزِى ٱللَّهُ ٱلشَّٰكِرِينَ ﴿١٤٤﴾
Muhammad is not but a messenger. [Other] messengers have passed on before him. So if he was to die or be killed, would you turn back on your heels [to unbelief]? And he who turns back on his heels will never harm Allah at all; but Allah will reward the grateful.
Abu Bakr recited this verse on the day of his death.
Sahih al-Bukhari 3902
Sahih... فمكث بمكة ثلاث عشرة سنة ...
"He stayed in Makkah for thirteen years."
Ibn Abbas: sent at 40, 13 years in Makkah, 10 in Madinah, died at 63.
Sahih Muslim 2348
Sahih... وأبو بكر وهو ابن ثلاث وستين ...
"And Abu Bakr died at sixty-three."
Anas: the Prophet, Abu Bakr and Umar each died at 63.
Where the ruling is recorded
- al-Shama'il al-Muhammadiyya (al-Tirmidhi), Chapter on the age of the Messenger of Allah. Gathers the reports of his age and the variants.
- Fath al-Bari (Ibn Hajar), Commentary on Kitab al-Manaqib, chapter on the death of the Prophet. Reconciles the reports of 60, 63 and 65.
- al-Bidaya wa al-Nihaya (Ibn Kathir), Events of the year 11 AH, the death of the Prophet. Gives the day and month of his death and the reports about the date.
This answer is pending review by the scholars on our team. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.