Heavy metals such as iron, copper, manganese, cobalt, silver, zinc, nickel, and arsenic have accumulated in soils for a long time due to the dumping of industrial waste and sewage. Various techniques have been adapted to overcome metal toxicity in agricultural land but utilizing a biological application using potential microorganisms in heavy metals contaminated soil may be a successful approach to decontaminate heavy metals soil. Therefore, the current study aimed to isolate endophytic bacteria from a medicinal plant (Viburnum grandiflorum) and to investigate the growth-promoting and heavy metal detoxification potential of the isolated endophytic bacteria Agrococus tereus (GenBank accession number MW 979614) under nickel and zinc contamination. Zinc sulfate and nickel sulfate solutions were prepared at the rate of 100 mg/kg and 50 mg/kg in sterilized distilled water. The experiment was conducted using a completely random design (CRD) with three replicates for each treatment. Inoculation of seeds with A. tereus significantly increased the plant growth, nutrient uptake, and defense system. Treatment T4 (inoculated seeds), T5 (inoculated seeds + Zn100 mg/kg), and T6 (inoculated seeds + Ni 100 mg/kg) were effective, but T5 (inoculated seeds + Zn100 mg/kg) was the most pronounced and increased shoot length, root length, leaf width, plant height, fresh weight, moisture content, and proline by 49%, 38%, 89%, 31%, 113%, and 146%, respectively. Moreover the antioxidant enzymes peroxidase and super oxidase dismutase were accelerated by 211 and 68% in contaminated soil when plants were inoculated by A. tereus respectively. Similarly the inoculation of A. tereus also enhanced maize plants' absorption of Cu, Mn, Ni, Na, Cr, Fe, Ca, Mg, and K significantly. Results of the findings concluded that 100 mg/kg of Zn and Ni were toxic to maize growth, but seed inoculation with A. tereus helped the plants significantly in reducing zinc and nickel stress. The A. tereus strain may be employed as a potential strain for the detoxification of heavy metals.