Endophytic bacteria offer numerous advantages in the control of postharvest diseases. Bacillus velezensis has been identified as a promising biocontrol agent against postharvest pathogens in various fruits and vegetables. In this study, B. velezensis BE1 was identified by 16S rRNA sequencing and caused 76.9 % inhibition against Botrytis cinerea in dual culture assay. The cell-free culture filtrate (CFCF) of B. velezensis strongly inhibited the growth, spore germination, and germ tube elongation of B. cinerea. Moreover, 11 bioactive compounds were identified in the CFCF using gas chromatography-mass spectrometry, and phthalic acid, dioctyl ester was the predominant component by 72.92 %. Scanning and transmission electron microscopy observations revealed that the CFCF causes irreversible morphological and ultrastructural damage to the fungal hyphae and conidia, including deformed, wrinkled, lysis, collapse, and degradation of cytoplasmic organelles. The incidence and severity of gray mold were significantly suppressed after applying CFCF at 50 % in tomato fruit. The application of CFCF caused an increase in the total phenolics and flavonoids content in tomato fruit compared with the control throughout the experiment. Furthermore, the activities of enzymes associated with defense such as phenylalanine ammonia-lyase, polyphenoloxidase, and peroxidase were significantly higher in the treated tomatoes relative to the untreated group. These results indicate that B. velezensis BE1 has significant potential as an effective biocontrol agent against the pathogen B. cinerea, offering a valuable approach for controlling gray mold in postharvest fruit.