Unsupervised domain adaptation (UDA) enables training a model on labeled source data to perform well in a target domain without supervision, which is especially valuable in vision-based semantic segmentation. However, existing UDA methods often struggle with accurate semantic labeling at object boundaries and recognizing minor categories in the target domain. This paper introduces a novel UDA framework—SamDA—that incorporates the Segment Anything Model (SAM), a large-scale foundational vision model, as the mask generator to enhance edge segmentation performance. The framework comprises three core modules: a cross-domain image mixing module, a self-training module with a teacher–student network, and exponential moving average (EMA). It also includes a finetuning module that leverages SAM-generated masks for pseudo-label matching. Evaluations on the GTA5 and Cityscapes datasets demonstrate that SamDA achieves a mean IoU (mIoU) of 75.2, surpassing state-of-the-art methods such as MIC-DAFormer by 1.0 mIoU and outperforming all ResNet-based approaches by at least 15 mIoU. Moreover, SamDA significantly enhances the segmentation of small objects like bicycles, riders, and fences, with, respective, IoU improvements of 4.5, 5.2, and 3.8 compared to baseline models.