Coral reefs and seagrass beds form extensive shallow-water habitats, but few reports have assessed the extent to which fishes on coral reefs are segregated from or integrated with fish from seagrass habitats. To investigate this, we used visual census surveys to survey reef fish assemblages in 3 habitat types: (1) seagrass, (2) transition areas between seagrass and coral reef and (3) coral reefs, at 8 locations in an Indonesian marine protected area. Based on the density of juveniles and adults, 66 of the 212 fish species recorded were classified into 4 ecological groups: seagrass residents, generalists, nursery species and coral residents. Coral residents and nursery species were found in reef and transition habitats, seagrass residents in seagrass beds and transition habitats, and generalists showed a gradual decrease in density from coral reef to seagrass beds. In terms of reef fish density, seagrass residents and nursery species accounted for 21 and 17%, respectively, of the 66 species classified into ecological groups. Habitat segregation among life stages of some nursery species, where adults were found in a coral habitat and juveniles in seagrass, was indicative of ontogenetic shifts from seagrass to coral habitat. Segregation in the distribution of feeding groups among habitat types also occurred, with nocturnal piscivores and diurnal zoobenthivores mostly found in coral and transition habitats, while nocturnal zoobenthivores, herbivores and diurnal piscivores were mostly found in seagrass and transition habitats. These patterns differ from those reported in similar habitat types elsewhere, but overall the results support previous findings, i.e. that optimisation of predatory and resource competition mechanisms may be responsible for habitat segregation of fish species, life stages and feeding groups.