High-performance membranes are attractive for molecular-level separations in industrial-scale chemical, energy and environmental processes. The next-generation membranes for these processes are based on molecular sieving materials to simultaneously achieve high throughput and selectivity. Membranes made from polymeric molecular sieves such as polymers of intrinsic microporosity (pore size<2 nm) are especially interesting in being solution processable and highly permeable but currently have modest selectivity. Here we report photo-oxidative surface modification of membranes made of a polymer of intrinsic microporosity. The ultraviolet light field, localized to a near-surface domain, induces reactive ozone that collapses the microporous polymer framework. The rapid, near-surface densification results in asymmetric membranes with a superior selectivity in gas separation while maintaining an apparent permeability that is two orders of magnitude greater than commercially available polymeric membranes. The oxidative chain scission induced by ultraviolet irradiation also indicates the potential application of the polymer in photolithography technology.