The isolation of C-5 diolefins, mainly consisting of trans-piperylene, cis-piperylene, and isoprene, is a challenging task and requires complex and energy-intensive separation schemes. Particularly, the segregation of trans/cis-piperylene is the most challenging operation for geometric isomers. Here, we report an isostructural family of metal-organic frameworks, Mg-, Co-, and Ni-gallate, which are perfectly suitable for the precise matching of trans-piperylene molecules while excluding the slightly large cis-piperylene molecules, contributing to remarkable separation of trans/cis-piperylene via shape-size sieving. Significantly, Mg-gallate exhibits high affinity for trans-piperylene, leading to an outstanding trans/cis-piperylene uptake selectivity of 4.22 (298 K, 0.1 bar) in adsorption isotherms. This excellent separation performance is further attested by single-crystal x-ray diffraction of Ni-gallate loaded with trans-piperylene isomer. In breakthrough tests, M-gallate materials not only display excellent separation performance of trans- and cis-piperylene but also can accomplish complete segregation of the ternary mixture (trans-piperylene/cis-piperylene/isoprene) into individual compounds combined with zeolite 5A.