Background: Metabolic associated fatty liver disease (MAFLD) refers to metabolic dysfunction associated with fatty liver disease, and liver fibrosis stage is closely connected with liver-related and all-cause mortality. This study aimed to explore the association of sleep duration with liver fibrosis in the diabetic subgroup of the MAFLD population. Methods: This retrospective study analyzed 342 patients with MAFLD. Anthropometric measurements, clinical and biochemical markers, and lifestyle parameters were collected. Fibrosis was defined as fibrosis-4 ⩾1.3. Propensity score matching (PSM) was performed to match cases. Student’s t-test and chi-square tests were applied for group comparisons, and binary regression models were used to explore the independent risk factors of liver fibrosis. Results: Among the 342 subjects, 87 (25.4%) were diagnosed with fibrosis and 255 (74.6%) without. Baseline characteristic comparisons showed differences in age and diabetes duration between the two groups, and adjustment was made by PSM. Ultimately, the fibrosis group and nonfibrosis group each had 87 patients. The fibrosis group had shorter duration of nocturnal sleep (6.77 ± 1.59 h) than the nonfibrosis group (7.77 ± 1.92 h, p < 0.001). More patients in the fibrosis group stayed up late at night (32.2% versus 14.9%, p < 0.01). Visceral adipose tissue (VAT) areas were larger in the fibrosis group than in the nonfibrosis group ( p < 0.001). Glycemic profile, lipid profile, gamma-glutamyl transferase level, and serum uric acid level were not significantly different between the two groups. In the multivariate regression analysis, nocturnal sleep and VAT areas were independently associated with liver fibrosis, with odds ratios of 0.694 [95% confidence interval (CI) 0.551–0.875, p < 0.01] for nocturnal sleep and 1.031 (95% CI 1.014–1.048, p < 0.001) for VAT areas. Conclusion: Insufficient nocturnal sleep was independently related to a higher risk of fibrosis. Sleep modification might be beneficial in promoting the health of patients with MAFLD.