The adsorption process of the pharmaceutical pollutant in the soil is affected by its physicochemical properties and soil properties. In this study, the factors affecting the adsorption of tetracycline and diclofenac onto two different soils (S and M) were investigated using response surface methodology (RSM). The RSM design was used to optimize the five variable factors (pH (2–10), contact time (5–180 min), soil amount (1–10 g/L), temperature (25–45°C)) on the adsorption of tetracycline and diclofenac. The predicted optimal conditions obtained by RSM showed that pH was the most important variable affecting the adsorption of tetracycline and diclofenac. The optimum pH for the adsorption of tetracycline and diclofenac onto the soil samples S and M were found to be 4 and 2, respectively. The adsorbed amounts of tetracycline and diclofenac onto the soils S and M were calculated to be 14.82 mg/g, 12.43 mg/g, 189.40 mg/g, and 144.81 mg/g, respectively. In addition, the effects of soil organic matter, salt, and divalent cations on the adsorption of tetracycline and diclofenac onto soils were studied. The removal of soil organic matter slightly increased tetracycline adsorption, while inhibiting diclofenac adsorption. The presence of salt and divalent cations prominently suppressed the adsorption of tetracycline and diclofenac onto soils. A possible complex mechanism was proposed for TC and DCF adsorption, including ion exchange, electrostatic interaction, and some chemical bonds.