'Smart shrinkage' of rural residential space is closely related to strong social infrastructure. The layout of rural residential land can greatly contribute to coordinate the relationship between the development of rural residential and the protection of the ecological environment in the plateau area, particularly on the ecological fragile of Hehuang Valley in western China. Taking Datong County, Xining City, Qinghai Province of China as a study area, a systematic optimization was proposed for the layout of rural residential land using landscape ecological security patterns and potential social networks. First, the landscape security pattern was constructed from three aspects of soil-water conservation, biodiversity, and water resources protection, according to the environment characteristics and local ecological threats. A basic condition was then set to restrict the layout optimization of rural residential land. Secondly, an advanced spatial gravity model was applied to calculate the “attraction” between rural residential, considering that the rural residential was an organic whole of mutual connection and influence. A rural residential network was then constructed, where the mass center of rural residential was taken as the node and the gravity as the connecting edge. As such, the status function of rural residential was determined in the network using the centrality analysis of network nodes. Finally, an optimal classification was established to promote rural development, according to the requirements in Rural Revitalization Strategy. Furthermore, a systematic evaluation was achieved under the regional environment for the stable ecological security pattern and sustainable rural development, where the landscape ecological security pattern was taken as constraint conditions. The rural settlements in the study area were divided into four types, namely, focus development, potential optimization, control scale, and migration merge type. Correspondingly, the optimization strategy was also put forward. The results showed that there were 84 rural residential areas identified as focus development type in the study area, with an area of 21.00 km2, accounting for 37.22% of the total rural residential land of the town; 109 potential optimization type areas, with an area of 21.12 km2, accounting for 37.45% of the total rural residential land of the town; 66 control scale type areas, with an area of 10.27km2, accounting for 18.20% of the total rural residential land of the town; 29 migration merge type areas, with an area of 4.02km2, accounting for 7.13% of the total rural residential land of the town. Consequently, tradeoff decision-making is highly necessary to consider the interaction between landscape ecological security patterns and rural residential. In view of the regional ecological balance and security, it is also demanding for the potential social network pattern of rural settlement system, thereby alleviating the environmental strangeness of migrant farmers after relocation against the original living habits. As such, the “smart exit” of scattered idle rural settlements can make a great contribution to the “smart contraction” of rural living space, and the “smart growth” of rural development in fragile ecological environment areas. [ABSTRACT FROM AUTHOR]