Lithium–sulfur batteries are a promising energy-storage technology due to their relatively low cost and high theoretical energy density. However, one of their major technical problems is the shuttling of soluble polysulfides between electrodes, resulting in rapid capacity fading. Here, we present a metal–organic framework (MOF)-based battery separator to mitigate the shuttling problem. We show that the MOF-based separator acts as an ionic sieve in lithium–sulfur batteries, which selectively sieves Li+ ions while efficiently suppressing undesired polysulfides migrating to the anode side. When a sulfur-containing mesoporous carbon material (approximately 70 wt% sulfur content) is used as a cathode composite without elaborate synthesis or surface modification, a lithium–sulfur battery with a MOF-based separator exhibits a low capacity decay rate (0.019% per cycle over 1,500 cycles). Moreover, there is almost no capacity fading after the initial 100 cycles. Our approach demonstrates the potential for MOF-based materials as separators for energy-storage applications.