Gray mold rot, caused by Botrytis cinerea, is considered as one of the most harmful fungal diseases affecting postharvest tomato fruits. In the current work, we explore the biocontrol potential of 174 bacterial strains isolated from tomato rhizosphere, argan rhizosphere and a vermicompost to control this fungal pathogen. The in vitro dual culture study of isolated bacterial strains and the fungus-causing pathogen revealed that 31 isolates exhibited a substantial antifungal activity against B. cinerea mycelial growth. The inhibition rates ranged from 55.36 to 85.07%. Twelve bacterial strains which showed the highest antifungal properties (more than 79.6%) were subsequently investigated for their ability to produce compounds with antifungal activity, including diffusible substances, volatile compounds and hydrocyanic acid. These strains were then evaluated in vivo for their ability to reduce fruit decay caused by the fungus. Indeed, isolates VC-B1 (from vermicompost), RS-TB3, and RS-T6 (from the rhizosphere of tomato root), and RH-TB11 (from the tomato rhizoplane) released the most active diffusible substances, which totally inhibited the mycelial growth of B. cinerea. In addition, bacterial strains RS-TB1 and RS-T6 isolated both from the tomato rhizospheric soil were among the isolates that produced the most effective volatile compounds. They reduced the mycelial growth of the fungal pathogen by 75.36% ± 7.24% and 72.94 ± 4.129% respectively. Moreover, RS-TB3, RS-TB4, RH-TB1, and VC-B1 exhibited the highest production of hydrocyanic acid, followed by RS-TB1, VC-3, and VC-13. In vivo bioassays showed disease reduction ranging from 37.92% to 93.14%, with VC-1, VC-5, and RS-T4 showing the highest efficacy. This study identifies several bacterial strains with high potential for biocontrol of B. cinerea in postharvest tomatoes, presenting a promising alternative to chemical fungicides for managing gray mold rot.