Sayyiduna Ibn Umar (may Allah be pleased with them both) said that when the Messenger of Allah (peace and blessings be upon him) went to Makkah, he would pray in Masjid al-Shajarah, and when he returned, he would pray at Dhul-Hulayfah in the bottom of the valley and spend the night there until morning came.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 10367