‘Amr b. ‘Abasa reported the Prophet as saying, “If anyone builds a mosque that God may be mentioned in it, a house will be built for him in paradise; if anyone emancipates a Muslim, that will be his ransom from jahannam; if anyone develops a grey hair while in 'God’s path, it will be a light for him on the day of resurrection.”
It is transmitted in Sharh as-sunna.