Praise be to Allah.
Praying in al-Masjid al-Haraam and tawaaf around the Ka’bah are both acts that bring great virtue. Ahmad (14284) and Ibn Maajah (1406) narrated that Jaabir said: “The Messenger of Allaah (peace and blessings of Allaah be upon him) said: ‘One prayer offered in al-Masjid al-Haraam is better than one hundred thousand prayers offered elsewhere.’” Al-Haafiz said: the men of its isnaad are thiqaat (trustworthy). It was classed as saheeh by al-Albaani in Irwa’ al-Ghaleel, 1129.
Al-Tirmidhi (959) narrated that ‘Abd-Allaah ibn ‘Umar said: “I heard the Messenger of Allaah (peace and blessings of Allaah be upon him) say, ‘Whoever circumambulates this House seven times, fulfilling all the conditions of tawaaf, it is as if he freed a slave. He does not put down one foot and lift the other but Allaah will erase one bad deed and will record one good deed for him.” Classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
Shaykh Ibn Baaz (may Allaah have mercy on him) was asked: Is it better for the one who is staying in Makkah to circumambulate the House or to pray?
As to whether prayer is better than tawaaf or tawaaf is better than prayer, this is a matter which is subject to further discussion. A number of scholars stated that it is better for the stranger to do a lot of tawaaf, because prayer may be done anywhere, not only in al-Masjid al-Haraam, but tawaaf can only be done in Makkah, and he does not live in Makkah, rather he will leave and go away from it. So it is more appropriate for him to make the most of the opportunity to do tawaaf.
But for those who are resident in Makkah, prayer is more important because prayer is better than tawaaf, so if they do more prayers, that is better.
Majmoo’ Fataawa al-Shaykh Ibn Baaz, 16/367.