Senior officials said there had been no major incidents and the logistical, security and health plans had been successful, even with some heavy rainfall.
Pilgrims took part in a symbolic stoning of the devil, part of the Haj rituals, in Jamarat before returning to Mecca, where the Grand Mosque filled with worshippers preparing to depart.
Saudi pilgrim Jasem Ali Haqawi said he was grateful to the authorities for a well-run week of rituals.
“Nobody comes to the Haj without things inside him that he wants to ask from God,” he said while preparing to conduct final prayers in Mecca. “The sick, the indebted ... such things only God can grant and so you ask God for whatever you want.”
Nearly 2.5 million pilgrims, most of them from abroad, came for the five-day ritual this year. Attendance is a religious duty, once in a lifetime, for every able-bodied Muslim who can afford it.
More than 120,000 members of the security forces and more than 30,000 health workers were on hand this week to maintain safety and provide first aid.
A crush in 2015 killed nearly 800 pilgrims, according to Riyadh, when two large groups of pilgrims arrived at a crossroads east of Mecca.
Saudi authorities said at the time that the crush may have been caused by pilgrims failing to follow crowd control rules.