Basal-like breast carcinoma is characterized by poor prognosis and high intratumour heterogeneity. In an immortalized basal-like breast epithelial cell line, we identified two anticorrelated gene-expression programs that arise among single extracellular matrix (ECM)-attached cells during organotypic three-dimensional culture. The first contains multiple TGF-β-related genes including TGFBR3, whereas the second contains JUND and the basal-like marker KRT5. TGFBR3 and JUND interconnect through four negative-feedback loops to form a circuit that exhibits spontaneous damped oscillations in three-dimensional culture. The TGFBR3-JUND circuit is conserved in some premalignant lesions that heterogeneously express KRT5. The circuit depends on ECM engagement, as detachment causes a rewiring that is triggered by RPS6 dephosphorylation and maintained by juxtacrine tenascin C, which is critical for intraductal colonization of basal-like breast cancer cells in vivo. Intratumour heterogeneity need not stem from partial differentiation and could instead reflect dynamic toggling of cells between expression states that are not cell autonomous.