Bioflocculation has become the method of choice in wastewater treatment because of its effectiveness, environmental friendliness and innocuousness to humans. In this study, the bioflocculant-producing bacterium was isolated and its bioflocculant was used in wastewater treatment. The isolate was identified by 16S rRNA gene sequencing analysis. Its culture conditions (inoculum size, carbon and nitrogen sources, pH, temperature and time) were optimised using the one-factor-at-a-time assay. The cytotoxicity of the bioflocculant was assessed on human colorectal adenocarcinoma cells (Caco2) by tetrazolium-based colorimetric method. The ability of the bioflocculant to reduce biochemical oxygen demand (BOD) and chemical oxygen demand (COD) in wastewater was evaluated using Jar test. The bacterium was identified as Bacillus subtilis CSM5 and the maximum flocculating activity of 92% was observed when fructose and urea were used as nutrients and the culture conditions were adjusted to 30 °C, pH 9, 160 rpm and 72 h of incubation. Caco2 exhibited 90% viability when the highest bioflocculant concentration of 200 µg/µL was used. The reduction of BOD and COD was achieved at 59 ± 3.1 and 75 ± 0.4%, respectively. In conclusion, B. subtilis CSM5 is a good candidate for bioflocculant production and its bioflocculant has good potential for use in wastewater treatment.