Rich and diversified assemblages of larval stage phytophagous insects exploit the flower heads of the thistle tribe Cardueae. As these insects form communities within a shared resource unit with well-defined spatial boundaries, they offer a good opportunity to study the guild organization of communities of endophytic insects. We used random combinations of members of phytophagous taxa, which radiated on hosts of the subtribes Centaureinae and Carduinae, as species pools for null models to determine whether and to what extent the composition of the guilds in Cardueae flower heads follows predictable assembly rules. We tested two hypotheses and found that in both cases the null model can be rejected. Assembly rule 1: species assemblages in flower heads follow the rule of intra-generic isolation (i.e. each guild member belongs to a different genus) significantly more often than random combinations of Cardueae insects. We show that, where violations of this rule occur, they are almost exclusively due to the occurrence of a combination of those congeners of the genera Urophora, Larinus and Cera-jocera, whose larval activities differ to some extent temporally and/or spatially. Assembly rule 2: the composition of guilds tends to develop towards a maximum of intra-guild differentiation – the three complementary trophic types (e.g. gall and callus feeders, receptacle and ovary chewers, omnivores and intra-guild predators) co-occur in guilds significantly more often than in random combinations. Our results show that the organization of phytophagous guilds in Cardueae flower heads is mainly a result of invasions due to host shifts. We suggest that in addition to larval competition for space and food, constraints such as the availability of enemy-free space and/or 'free rendezvous arenas' have shaped the structure of the guilds investigated.