All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The Sharee’ah texts prove that praying in the mosque where the Athaan (call to the prayer) is called is given priority over praying in Mussallah (a place for prayer). The evidence for this is the following Hadeeth reported by Muslim that the Prophet said: “Whoever wants to meet His Lord tomorrow (on the Day of Judgement) while being a Muslim, he should adhere to performing these prayers where they are called for.”
There are two other reasons why the mosque is preferred over the Mussallah: (1) there is a greater number of people who pray in the mosque as compared to that of the Musallah; (2) the distance to the mosque is usually further as compared to the Musallah. All these are pieces of evidence that praying in the mosque is favored over praying in the Musallah.
Al-Bukhaari reported that the Prophet said: “The greatest reward in prayer is given to the one who walks to the mosque from the longest distance.”
Besides, the Prophet said: “The prayer of a man with another man has greater reward than his praying alone, and his prayer with two men is more rewarded than his prayer with one man, and Allah, The Almighty likes the greatest number (in congregation).” [Abu Daawood and An-Nasaa-i]
Based on the above reason, we believe that praying in a distant mosque is better. But if the Athaan is called in a nearer mosque and if the five prayers are performed in it, then praying in it is sufficient even if it is not a Waqf (endowment) mosque as there is nothing that favors an endowment mosque over another mosque.
Allah knows best.