The prophet Muhammad said that those who receive the greatest reward from God are those who live farthest from a mosque and have to walk the farthest to attend prayers with the community. Observing prayers in a congregation with an imam is more rewarding than praying alone and going to sleep.