Galaxy clusters in the line of sight to background quasars - II. Environmental effects on the sizes of baryonic halo sizes