Bacteriocins are the group of antimicrobial peptides synthesized by certain groups of bacterial species. A bacteriocin-producing bacterial strain of Rhizobium leguminosarum DM 20 was isolated from leguminous plant. The produced bacteriocin was found to exert its antibacterial effect against Staphylococcus aureus, a significant food spoiling pathogen. The molecular interaction between bacteriocin and enterotoxin protein of Staphylococcus aureus depicted the effectiveness of the former produced against the pathogen. With the aim to enhance the production of bacteriocin, the main three parameters, namely temperature, pH and cultivation time, were optimized. Response surface methodology (RSM) was applied for the optimization process instead of the conventional “one-at-a-time” method. It was found that the observed values were about 15–18% higher than that of expected ones. Artificial neural network (ANN) was also applied for conforming the optimization model.