The network polyimide (PI) precursor is a promising candidate to fabricate the advanced carbon molecular sieve (CMS) membrane since its robust crosslinked structure could prevent pore structure collapse during CMS formation. Exploring the relationship between network PI precursor structure and CMS membrane is highly significant. Herein, a novel brominated network PI precursor was fabricated via in-situ cross-linking technique firstly, and then the thermally induced bromination/debromination process was applied to tune the microporosity and gas transport properties of network PI precursor and its derived CMS membranes. After the bromination/debromination and carbonization at 550 °C, the resultant CMS membrane exhibited both high gas permeability and gas selectivities compared to its un-brominated network PI precursor derived CMS membrane. This is due to the bromination/debromination and carbonization enable the CMS membrane possesses large d-spacing values (11.06 Å), high BET surface areas (538.57 m2/g), and high percentage (∼71 %) of ultra-micropores. For instance, 6F-TA/TA-Br-550/30 membrane exhibits great CO2/CH4 separation ability, with a CO2 permeability of 6300 Barrer and a CO2/CH4 selectivity of 46.11, which is suppressed the latest 2019 trade-off curves. We anticipate that the present bromination/debromination and carbonization could provide a fresh perspective on the rational design of network PI precursor and its derived CMS membrane with excellent gas separation performance.