The rapid growth in demand for large-scale infrastructure around the world calls for a new type of organisation, which we label the Megaproject-based Firm (MBF). We conceptualise the MBF as a core permanent entity that delivers multiple megaprojects with partners in project networks, in several large temporary organisations crossing the boundaries of the firm. We use 78 interviews to identify how the learning within and between these megaprojects has enabled the firm to build programme management capabilities over time. Our results show that adaptability, flexibility, and the design of the roles and responsibilities between clients and delivery partners are critical ingredients of programme management. Megaprojects should be delivered through a collaborative relationship with clients, not for clients. The involvement in a series of megaprojects in parallel and sequentially offers a new type of project capability building challenge for firms, adding to the literature on project-based firms and project capabilities.