Anaerobic digestion (AD) is a sustainable and feasible technology to treat livestock manure. However, the effects of coexisting ammonia and antibiotics on the AD process of livestock manure are still unclear. A potential ammonia-antibiotics synergistic co-inhibition might occur. Therefore, the individual and combined effects of different ammonia (1000–7000 mg NH4+-N/L) and sulfamethoxazole (SMX) concentrations (0.1–20 mg SMX/L) on the biomethanation process were explored. The results indicated that a significant reduction (43.83%) in methane production was observed under individual 5000 mg NH4+-N/L (A5000 +SMX0.1), while a 20.11% increase was achieved by individual 0.5 mg SMX/L (A1000 +SMX0.5). Under the combined 5000 mg NH4+-N/L and 0.5 mg SMX/L (A5000 +SMX0.5), ammonia inhibition was alleviated with methane production increasing by 58.46% compared with A5000 +SMX0.1 (still 25.89% lower than A1000 +SMX0.5). However, combined high SMX concentrations (≥ 5 mg/L) and ammonia levels (≥ 5000 mg NH4+-N/L) might exacerbate the inhibition of the AD process. Moreover, microbial analyses revealed that A1000 +SMX0.5 improved the acetoclastic methanogenic pathway by enriching key acetoclastic methanogens (Methanothrix), syntrophic bacteria (Syntrophomonas) and hydrolytic-acidogenic bacteria (norank_f__Bacteroidetes_vadinHA17) under high ammonia stress. Conversely, under 5 mg SMX/L the abundances of these functional microorganisms decreased. Metagenomic results further suggested that 0.5 mg SMX/L was associated with increased abundances of critical metabolic genes (glk, ak, acs, and mtr ), which were responsible for improving hydrolysis-acidogenesis, acetogenesis and acetoclastic methanogenesis and contributed to alleviation of ammonia inhibition. Overall, these batch-scale results could benefit future evaluation and optimization of continuous-flow anaerobic digesters treating substrates coexisting with ammonia and antibiotics.