It is obligatory for men to attend the prayer in congregation in the mosque. Not praying in congregation is one of the signs of hypocrisy. See question no. 120.
The further away one’s house is from the mosque, the greater the reward.
It was narrated that Abu Moosa said: The Prophet (peace and blessings of Allaah be upon him) said: “The people who will have the greatest reward for prayer are those who come the furthest distance. Narrated by al-Bukhaari, 623; Muslim, 622.
Prayer in congregation is obligatory for those who live close to the mosque, not for those who live far away.
The Sunnah describes those who are regarded as living close to the mosque as being those who can hear the call to prayer.
What is meant is those who can hear the call to prayer from the mosque with no amplification of the muezzins’s voice, when the muezzin raises his voice, and there is no wind or noise etc to interfere with hearing it.
Muslim (653) narrated that Abu Hurayrah said: A blind man came to the Prophet (peace and blessings of Allaah be upon him) and said, “O Messenger of Allaah, I do not have anyone to guide me to the mosque,” and he asked the Messenger of Allaah (peace and blessings of Allaah be upon him) to grant him a concession allowing him to pray in his house, and he granted him that. Then when he turned to leave, he called him back and said, “Can you hear the call to prayer?” He said, “Yes.” He said, “Then respond to it.”
Ibn Maajah (793) narrated from Ibn ‘Abbaas that the Prophet (peace and blessings of Allaah be upon him) said: “Whoever hears the call to prayer and does not respond, there is no prayer for him (i.e., his prayer is not valid), except for the one who has an excuse.” Classed as saheeh by al-Albaani in Saheeh al-Jaami’, 637.
Al-Nawawi (may Allaah have mercy on him) said in al-Majmoo’, 4/353:
What is meant by hearing the call to prayer is when the muezzin stands at the edge of the town and other sounds are silent and the wind is still, and one is listening out. If a person can hear him, he is obliged (to attend prayers in congregation), and if he cannot hear him then he is not obliged.
The Standing Committee was asked: If I can hear the muezzin from a distance of eight hundred meters, should I pray where I am or go to the mosque where the call to prayer was made?
You have to go to this mosque and pray there with the congregation, or in any other mosque that may be easier for you, so long as you are able to do that… then the Committee quoted as evidence the two ahaadeeth mentioned above.
The Committee was also asked about a man who lives on the eighth floor and the mosque is about 500 meters away from him. Is it permissible for him to offer the prayers in congregation with his family members in his apartment?
Congregational prayer in the mosque is obligatory, so you have to attend the mosques and pray the obligatory prayer there with the Muslims. You do not have the right to a concession allowing you to pray at home with your family because of this distance.
Fataawa al-Lajnah al-Daa’imah, 8/59
Shaykh Ibn ‘Uthaymeen was asked:
Is there any definition of the distance between one’s house and the mosque?
There is no specific distance defined in sharee’ah, rather that depends on ‘urf (custom) or the distance within which the adhaan can be heard without a microphone.
As’ilah al-Baab al-Maftooh, question no. 700.
Shaykh Ibn Baaz said:
The one who can hear the call to prayer given in a regular voice without amplification is obliged to respond and to come and pray in congregation in the mosque in which the call is given…
But for those who live far away from the mosque and cannot hear the call to prayer except with amplification do not have to come to the mosque. They and those who are with them may pray in a separate congregation. If they take the trouble to attend the prayer with the congregation in the mosque whose call to prayer they cannot hear except with amplification because they are too far away, that will bring them a greater reward.
Majmoo’ Fataawa al-Shaykh Ibn Baaz (may Allaah have mercy on him), 12/58.
And Allaah knows best.