S.H.
I breastfed both my kids, and for me, I let them self-wean.
My daughter self-weaned at about 2.5 years old, and my son at about 1 year old.
For a "toddler" child who is doing extended breastfeeding... you CAN do it. But it takes egging them on, or encouraging them. BUT, I have found, that they will 'self-wean' when they do.
For me, and what I did is:
1) I talked to my girl about it...explaining gently that she is a "big girl" now and one day, she will need to stop. (2) Use distraction and redirection. ie: if they "ask" to nurse... say "One moment, Mommy is busy..." and then stand-up and make yourself "busy." Do NOT sit down or lie down. KEEP busy. Then, they will either forget about it or will get distracted. (3) Nurse someplace else. NOT IN THE BED. NOT LYING DOWN. For me, if my daughter wanted to nurse I did... but, I started doing in a particular chair ONLY. Then for bed/nap, I laid down next to her... and co-slept, afterward. (4) Replace your boobs for something else... perhaps get him a special sippy cup or something. Or, start a NEW "habit" pre-bed, and make it sound EXCITING! ie: for a "big boy." (5) Give him a 'lovey' to have for sleeping... ie: my kids both have certain stuffed animals they LOVE to sleep with. Let him choose one just for himself. (6) YOU DECIDE how long to nurse... don't just let him stay at the breast for eternity. After a couple minutes, just pull away. Then open a book or something and read to him. Make the book reading the 'last' thing you do to sleep, NOT the nursing.
(7) Teach him "manners." For me, I taught my girl that pulling-up my shirt and grabbing at me was not "polite." NOR, doing it anytime. It is only for certain times... and "Mommy" decides. My girl then began to 'ask' instead of just using me like a water-fountain or a 24-hour 7-Eleven store.
My son on the other hand, just started to dislike nursing and would actually 'grumble' when I put him to breast and would slap away my breasts and yell and turn away... but (he was hungry) and would indicate to me that he just wanted the bottle. So, that is how he stopped breastfeeding. He was less 'attached' to it, unlike my daughter and they each had their own sense of 'self-weaning.'
Bear in mind, that for some kids, yes they are VERY attached to nursing. But, it WILL one day be a distant memory. But it takes time. For me, my girl DID stop on her own... just one day out of the blue she told me "I'm a big girl now, I don't drink (from you)..." and she even laughed and thought it was silly/funny that she was still nursing. And that was the end of it. She stopped on her own!
For some of my friends (who had kids this age), what they did is: they put Band-Aids on their breasts to cover their nipples, and they simply told their child "Mommy has a bo-bo..." or, "Mommy's milk doesn't work anymore..." and for them they said this worked!
Your son IS weaning... because he only nurses to sleep. But like anything else, this is the hardest 'time' for them to let go of. Because it's comforting. So try to replace it with something else...
Or maybe, get him his own doll... and let him put the doll to sleep... and with a toy bottle. Let him sleep with it and cuddle with it. If that is, he likes stuffed animals/dolls.
All the best, I know it's not easy. But it WILL end one day.
Good luck,
Susan