Rapid industrial development and frequent oil spills have led to the generation of large amounts of oily wastewater. Therefore, there is an urgent need to develop environmentally friendly materials to achieve efficient oil/water separation. In this study, the CO2-responsive PAN-co-PDEAEMA nanofiber membrane with gas-tunable wettability was fabricated by electrostatic spinning. The combination of carbon dioxide responsiveness and hierarchical nanostructures enabled this prepared nanofibrous membrane to achieve switchable oil/water separation driven by gravity. Before CO2 stimulation, oil can quickly pass through the nanofiber membrane, while water is trapped by the nanofiber membrane due to the oleophilic/hydrophobic surface. In contrast, after CO2 stimulation, the opposite separation process can be achieved due to the hydrophilic/underwater oleophobic surface. After five cycles of switchable oil/water separation, the fluxes of oil and water through the nanofibrous membrane did not change significantly, but fluctuated slightly around 15,500 and 10,000 L•m−2•h−1, respectively, indicating high efficiency and good repeatability. The CO2-responsive nanofiber membrane has great potential for application in oily wastewater treatment.