The Messenger of Allah ﷺ stayed in Mecca for thirteen years, and he passed away at the age of sixty-three.In another wording, the Messenger of Allah ﷺ remained in Mecca for thirteen years receiving revelation, then in Medina for ten years, and he died at the age of sixty-three.
أن رسول الله ﷺ مكث بمكة ثلاث عشرة، وتوفي وهو ابن ثلاث وستين. وفي لفظ: أقام رسول الله ﷺ بمكة ثلاث عشرة سنة يوحى إليه، وبالمدينة عشرا، ومات وهو ابن ثلاث وستين سنة.
Bukhari narrated it in the Book of the Virtues of the Ansar (3903) and Muslim in the Book of Virtues (2351, 117), both of them through the route of Rawh bin Ubada, who said, Zakariya bin Ishaq narrated to us, from Amr bin Dinar, from Ibn Abbas, who said, and then he mentioned it.The second wording was narrated by Muslim in the Book of Virtues (2351, 118), from Ibn Abu Umar, who said, Bishr bin Sari narrated to us, who said, Hammad narrated to us, from Abu Jamra Dubai, from Ibn Abbas, with the same wording. He also narrated it (2353, 121) from Ammar, the freed slave of Banu Hashim, who said, "I asked Ibn Abbas, how old was the Messenger of Allah ﷺ on the day he died?" He said, "I did not think that someone like you, from his own people, would be unaware of that." He said, I said, "I have asked people and they gave me differing answers, so I wanted to know your view on it." He said, "Are you asking for an estimate?" He said, I said, "Yes." He said, "He lived forty years before he was sent as a prophet. He was then a prophet for fifteen years in Makkah, during which he was sometimes secure and sometimes in fear, and for ten years from his emigration to Madinah."Likewise, from Ammar bin Abu Ammar, from Ibn Abbas, who said, "The Messenger of Allah ﷺ stayed in Makkah for fifteen years. For seven of those years he would hear the voice and see the light without seeing anything else, and for eight years revelation came down to him. He then stayed in Madinah for ten years."In his statement, "He stayed in Makkah for fifteen years," there is something odd. The correct account in this matter is his statement, "He stayed in Makkah for thirteen years and in Madinah for ten, and he died at the age of sixty-three," which agrees with the view of the majority. Perhaps the error here comes from Ammar bin Abu Ammar, the freed slave of Banu Hashim.Bukhari said in Tarikh Saghir (29/1), after quoting the statement of Ammar bin Abu Ammar, from Ibn Abbas, "The Prophet ﷺ died at the age of sixty-five," "He is not corroborated in this, and Shuba used to criticize Ammar."I say, Ibn Hibban mentioned him in Thiqat (267/5) and said, "He used to make mistakes."