In this study, we used a 16S rRNA gene barcoded pyrosequencing approach to sample bacterial communities from six biotopes, namely, seawater, sediment and four sponge species (Stylissa carteri, Stylissa massa, Xestospongia testudinaria and Hyrtios erectus) inhabiting coral reefs of the Spermonde Archipelago, South Sulawesi, Indonesia. Samples were collected along a pronounced onshore to offshore environmental gradient. Our goals were to (1) compare higher taxon abundance among biotopes, (2) test to what extent variation in bacterial composition can be explained by the biotope versus environment, (3) identify dominant (>300 sequences) bacterial operational taxonomic units (OTUs) and their closest known relatives and (4) assign putative functions to the sponge bacterial communities using a recently developed predictive metagenomic approach. We observed marked differences in bacterial composition and the relative abundance of the most abundant phyla, classes and orders among sponge species, seawater and sediment. Although all biotopes housed compositionally distinct bacterial communities, there were three prominent clusters. These included (1) both Stylissa species and seawater, (2) X. testudinaria and H. erectus and (3) sediment. Bacterial communities sampled from the same biotope, but different environments (based on proximity to the coast) were much more similar than bacterial communities from different biotopes in the same environment. The biotope thus appears to be a much more important structuring force than the surrounding environment. There were concomitant differences in the predicted counts of KEGG orthologs (KOs) suggesting that bacterial communities housed in different sponge species, sediment and seawater perform distinct functions. In particular, the bacterial communities of both Stylissa species were predicted to be enriched for KOs related to chemotaxis, nitrification and denitrification whereas bacterial communities in X. testudinaria and H. erectus were predicted to be enriched for KOs related to the toxin-antitoxin (TA) system, nutrient starvation and heavy metal export.