My daughter self-weaned at about 2.5 years old.
I would talk to her... about it and that one day she would not need to do that etc. One day, she just laughed and told me she doesn't drink from me anymore. She thought it was funny. And it was all done for her. Just like that.
I still had some milk. I could squirt it out and she told me there is still milk.
And, I did not just give in each time she wanted to. Gradually, she'd just get less and less interested.
Once, when she was about 2 or so, I was pregnant. And it hurt when she nursed. I would tell her, it is sensitive there. My OB/GYN said it can or may cause contractions etc. But he let me nurse at my discretion.
But with that pregnancy, it ended up as a miscarriage. It was not due to nursing however. The embryo just was not developing and one day there was just no heartbeat and I was then miscarrying.
For me, when my daughter was a Toddler and nursing, I just told her RULES about it. ie: it is Mommy's boobs, don't just pull at me, only at home, and she needs to wait sometimes. She understood. You need to teach the child, at that age, manners about it. And no, my daughter did not use me as a comfort thing or tantrum about it. And I didn't use it to placate my daughter. She understood.
My daughter self-weaned, which was my, choice. BUT once she was about 2 years old, I taught her rules and manners, about it. And when she quit, it was her choice. By then, the child naturally lessens, the frequency of it. At least that is how my daughter was.
Then for my son, he self-weaned at about 1 years old. He'd just pretty much, slap my boobs away and grumble when/if I put him to breast. He was just done.