Soil salinization is a critical environmental issue that limits plant productivity and disrupts ecosystem functions. As important indicators of soil environment, soil microbes play essential roles in driving nutrient cycling and sustaining ecosystem services. Therefore, understanding how microbial communities and their functional potentials respond to varying levels of soil salinization across different land use types is crucial for the restoration and management of salt-affected ecosystems. In this study, we randomly selected 63 sites across the Hetao Plain, covering an area of ∼2500 km2. Our results showed that both salinity- and fertility-related soil parameters were significantly correlated with bacterial and archaeal diversities, with soil salinity emerging as the stronger predictor of prokaryotic diversity. Intriguingly, bacterial and archaeal communities were tightly interlinked but displayed opposite trends in response to environmental factors, indicating a clear microbial niche differentiation driven by soil salinity. Moreover, the generalist functions of bacteria and archaea (e.g., chemoheterotrophy) exhibited contrasting responses to environmental parameters, while their specialist functions (e.g., nitrification) responded consistently. These findings highlight the pivotal role of soil salinity in shaping the niche differentiation of bacterial and archaeal communities in saline soils, providing insights to guide salinity-centered restoration strategies for effective marginal land management.