“Malay” means consciousness or awareness, but I don’t think that word fits into your sentence. Perhaps “malayo” (far) is what it’s supposed to be.
Tahanan = home/house; mga tahanan = homes/houses
Madikit = sticky
Samahan (stress on “han”) = associations, relationships, camaraderie, fellowship, friendship
“kapag hindi masyadong malayo ang mga tahanan, mas madikit ang samahan.” = when the houses are not too far apart, camaraderie is more close-knit.