We investigate the geographical and historical context of diversification in a complex of mutualistic Crematogaster ants living in Macaranga trees in the equatorial rain forests of Southeast Asia. Using mitochondrial DNA from 433 ant colonies collected from 32 locations spanning Borneo, Malaya and Sumatra, we infer branching relationships, patterns of genetic diversity and population history. We reconstruct a time frame for the ants' diversification and demographic expansions, and identify areas that might have been refugia or centres of diversification. Seventeen operational lineages are identified, most of which can be distinguished by host preference and geographical range. The ants first diversified 16-20 Ma, not long after the onset of the everwet forests in Sundaland, and achieved most of their taxonomic diversity during the Pliocene. Pleistocene demographic expansions are inferred for several of the younger lineages. Phylogenetic relationships suggest a Bornean cradle and major axis of diversification. Taxonomic diversity tends to be associated with mountain ranges; in Borneo, it is greatest in the Crocker Range of Sabah and concentrated also in other parts of the northern northwest coast. Within-lineage genetic diversity in Malaya and Sumatra tends to also coincide with mountain ranges. A series of disjunct and restricted distributions spanning northern northwest Borneo and the major mountain ranges of Malaya and Sumatra, seen in three pairs of sister lineages, further suggests that these regions were rain-forest refuges during drier climatic phases of the Pleistocene. Results are discussed in the context of the history of Sundaland's rain forests.