It is narrated from Abu Rafi' (may Allah be pleased with him) that the Messenger of Allah (peace and blessings of Allah be upon him) said: "The neighbor has more right to pre-emption (shuf'ah)."
Hadith Referenceمسند الإمام الشافعي / كتاب الشفعة والصلح وإحياء الموات / 1492
Hadith Takhrijاخرجه البخاري الحيل، باب فى الهبة والشفعة (6977)، (6981)۔