The existing prototype learning approaches typically compute a single global prototype per category, which often struggles to achieve precise segmentation in adhesive edge regions and ambiguous areas. To address this issue, this paper proposes a context-aware prototype-based semi-supervised medical image segmentation framework. It employs a self-distillation mechanism to learn affinity relationships between local regions of annotated images and query image patches, and utilizes clustering algorithms to generate fine-grained multi-prototype representations, significantly enhancing the discriminative capability and feature granularity of prototype learning. To further improve model performance, a memory bank mechanism is incorporated into both the self-distillation and prototype generation modules, effectively leveraging reliable information from annotated images to simultaneously enhance global contextual understanding and local detail segmentation accuracy. Moreover, contrastive learning is integrated into the training framework to achieve intra-class feature compactness and inter-class feature discriminability. Extensive experiments on two widely used datasets, LA and NIH Pancreas, demonstrate that the proposed method outperforms recent semi-supervised approaches. Under the 10% and 20% labeled data settings for semi-supervised segmentation tasks, our method achieves Dice scores of 90.18% / 91.15% on the LA dataset and 79.42% / 82.25% on the NIH Pancreas dataset, respectively, surpassing state-of-the-art semi-supervised methods.