Detergents are considered one of the important pollutants in hospital wastewater. Achieving efficient and bio-friendly methods for the removal of these pollutants is considered as a concern for environmental researchers. This study aims at studying the efficiency of a moving bed biofilm reactor (MBBR) system for removing linear alkyl benzene sulfonate (LAS) from hospital wastewater with utilization of response surface methodology (RSM). The present study was carried out on a reactor with continuous hydraulic flow using media k1 at pilot scale to remove detergent from hospital wastewater. The effect of independent variables including contact time, percentage of media filling and mixed liquor suspended solids (MLSS) concentration of 1000-3000 mg/l on the system efficiency were assessed. Methylene blue active substances (MBAS) and chemical oxygen demand (COD) 750-850 mg/l were used by closed laboratory method in order to measure the concentration of LAS. The results revealed that the removal efficiency of LAS detergent and COD using media k1, retention time of 24 hours, and MLSS concentration of around 3,000 mg/l were 92.3 and 95.8%, respectively. The results showed that the MBBR system as a bio-friendly compatible method has high efficiency in removing detergents from hospital wastewater and can achieve standard output effluent in acceptable time.