A prolonged length of stay (LOS) after surgery may result in higher hospital costs and hospital-acquired complications. This study aims to identify the risk factors associated with a prolonged hospital stay after robot-assisted thoracoscopic lung surgery for pediatric patients in the context of enhanced recovery after surgery. The data for this retrospective study were collected from pediatric patients undergoing robot-assisted thoracoscopic lung surgery. Patients were divided into two subgroups based on median postoperative LOS (Group I: LOS > median 5 days and Group II: LOS ≤ median 5 days). Logistic regression analysis was used to identify the potential factors associated with increased LOS. This study included 241 patients, 71 (29.46%) with an LOS of >5 days. The proportion of older children was significantly higher in Group I than that in Group II (P=0.004). Patients in Group I were more likely to experience a longer duration of anesthesia and surgery (P<0.001). They also had significantly higher rates of pneumonia, pleural effusion, and liver function damage (P<0.05). Several factors were identified to be associated with an increased LOS after robot-assisted thoracoscopic lung surgery: age >6 years [odds ratio (OR) =3.214, 95% confidence interval (CI): 1.464-7.502, P=0.004], surgery duration >100 min (OR =2.138, 95% CI: 1.296-4.387, P=0.005), intra-albumin (OR =13.778, 95% CI: 1.470-129.116, P=0.022), and blood loss >5 mL (OR =2.184, 95% CI: 1.082-4.409, P=0.029). The results revealed that older age, longer surgery duration, use of intra-albumin, and more blood loss predict longer postoperative hospital stay in pediatric patients with congenital lung lesions after robot-assisted thoracoscopic lung surgery.