Short answer
He was 25. According to the best-known report Khadijah was 40, though some reports make her younger, around 28. They were married for about 25 years, until her death about three years before the Hijrah, and he took no other wife while she lived.
The mainstream Sunni account, as recorded by Ibn Hisham, Ibn Sa'd and later historians, is that he married Khadijah at 25 when she was 40. Other reports give her age as 28 or in her thirties. All agree she was his first wife and the mother of all his children except Ibrahim.
The four schools agree on this.
Explanation
Khadijah bint Khuwaylid was a respected and wealthy businesswoman of Quraysh. She hired the young Muhammad ﷺ, known as al-Amin (the trustworthy), to take her goods to Syria with her servant Maysara. Impressed by his honesty and character, she proposed marriage to him through a friend. His uncles agreed and the marriage took place.
He was 25. The best-known report, recorded by Ibn Hisham and Ibn Sa'd, gives her age as 40. Other reports cited by some historians put her at 28. Scholars mention both; the first is more widely known. She had been married twice before.
Their marriage lasted about 25 years. She was the first person to believe in him when revelation came, she comforted him and spent her wealth for Islam. She died in Makkah about three years before the Hijrah. He never married anyone else in her lifetime, and he remembered her with love for the rest of his life. He said he had been given love for her.
Read her full life on Khadijah bint Khuwaylid. For his later marriages, see Why did the Prophet have more than four wives?
The evidence
Sahih Muslim 2435
Sahih... إني قد رزقت حبها ...
"I was blessed with love for her."
His love for Khadijah after her death.
Sahih Muslim 2436
Sahih... لم يتزوج النبي صلى الله عليه وسلم على خديجة حتى ماتت ...
"The Prophet did not marry anyone alongside Khadijah until she died."
Their marriage was monogamous for its whole length.
Sahih al-Bukhari 3896
Sahih... توفيت خديجة قبل مخرج النبي صلى الله عليه وسلم إلى المدينة بثلاث سنين ...
"Khadijah died three years before the Prophet left for Madinah."
Dates her death.
Where the ruling is recorded
- Sirat Ibn Hisham, Account of the Prophet's marriage to Khadijah. Gives his age 25 and the trading journey to Syria.
- al-Isaba fi Tamyiz al-Sahaba (Ibn Hajar), Entry on Khadijah bint Khuwaylid. Lists the reports of her age at marriage and at death.
- al-Bidaya wa al-Nihaya (Ibn Kathir), Chapter on the marriage of the Prophet to Khadijah. Discusses the different reports of her age.
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.