Deep learning is widely utilized for medical image segmentation, and its effectiveness is significantly influenced by the choice of specialized loss functions. In this study, we introduce an adaptive boundary-enhanced Dice (ABeDice) loss function, which integrates an exponential recursive complementary (ERC) function with the traditional Dice loss to improve segmentation accuracy. The ERC function leverages the prediction probability of each pixel and its complement to enhance the detection and localization of object boundaries. By dynamically adjusting the distribution of prediction probabilities, the ABeDice loss prioritizes higher probabilities, thereby improving both quantization potential and convergence rate. This adaption not only boosts the learning capability of the network but also enhances its segmentation performance. The effectiveness of the ABeDice loss was validated through extensive experiments using the Swin-Unet on three public datasets, including REFUGE, ISIC2018, and RIT-Eyes. The results showed that ABeDice achieved average Dice similarity coefficient of 0.9114, 0.8940, and 0.9418, respectively, outperforming traditional Dice loss and its variants, such as Generalized Dice loss, Tervkey loss, and Sensitivity-Specifity loss. The code is available at https://github.com/wmuLei/ABeDice.