The development of air-filled respiratory organs is crucial for survival at birth. We used a combination of live imaging and genetic analysis to dissect respiratory organ maturation in the embryonic Drosophila trachea. We found that tracheal tube maturation entails three precise epithelial transitions. Initially, a secretion burst deposits proteins into the lumen. Solid luminal material is then rapidly cleared from the tubes, and shortly thereafter liquid is removed. To elucidate the cellular mechanisms behind these transitions, we identified gas-filling-deficient mutants showing narrow or protein-clogged tubes. These mutations either disrupt endoplasmatic reticulum-to-Golgi vesicle transport or endocytosis. First, Sar1 is required for protein secretion, luminal matrix assembly, and diametric tube expansion. Subsequently, a sharp pulse of Rab5-dependent endocytic activity rapidly internalizes and clears luminal contents. The coordination of luminal matrix secretion and endocytosis may be a general mechanism in tubular organ morphogenesis and maturation.