The lung is a branched tubular network with two distinct compartments--the proximal conducting airways and the peripheral gas exchange region--separated by a discrete boundary termed the bronchoalveolar duct junction (BADJ). Here we image the developing mouse lung in three-dimensions (3D) and show that two nested developmental waves demarcate the BADJ under the control of a global hormonal signal. A first wave of branching morphogenesis progresses throughout embryonic development, generating branches for both compartments. A second wave of conducting airway differentiation follows the first wave but terminates earlier, specifying the proximal compartment and setting the BADJ. The second wave is terminated by a glucocorticoid signalling: premature activation or loss of glucocorticoid signalling causes a proximal or distal shift, respectively, in BADJ location. The results demonstrate a new mechanism of boundary formation in complex, 3D organs and provide new insights into glucocorticoid therapies for lung defects in premature birth.