M.,
First things first, it's not a 'bad habit'...you did what was necessary to ease your son through this transition and tough time. I praise you for making the choice to move on with your life, and be a strong and empowered Mommy for your little boy.
My son has never know his Dad and I together, and my son and I co-sleep...not because it was convenient but, because it works for us. It has given us a bond I wouldn't trade for the world.
But, transitioning behavior away from anything has to begin with consistent guidance, love and patience above all.
I would start by explaining that he is going to be a 'big brother'...this is a HUGE thing for kids. I was almost four when my sister was born, and my Mom made me her helper in every way she could. I would get her crackers and water if she was having morning sickness, and I would even rub her tummy to help my 'baby sister' know me. It's a big process that he NEEDS to be prepared for...but, this can also help you explain why Mommy needs her rest at night.
Have you introduced a 'lovey' ever? Or at this age, it could be a 'big brother' something that he can be in charge of taking care of at night...like Mommy has to take care of the baby? Just a thought...my son has a 'lovey' that he needs on and off (he's 2.5) but, if he has trouble staying asleep or has bad dreams the 'lovey' (we call it his 'dino buddy') comes out.
It's important to explain things to kids, they understand when it's very cut and dry...nothing fancy just the truth and the how and why.
My Mom and Dad set up a small cot for me in there room when my sister was born, so I could be there for her. I was actually jealous that the baby got to sleep in my parents room, and didn't understand why...after her nightwaking constantly I was over it in a week or two. You could try that with your son now...tell him that you need space and that if he needs to be close to you he can lay down in the special bed.
My good friend has older kiddos, and she takes them back in their rooms and sits in a chair next to their bed while they go back to sleep. But, explains Mommy is going back to her bed to rest so the baby can grow. They get it, and after a while she says it's more about knowing that Mommy is there, than actually sleeping in the same bed.
I think you have plenty of time to transition him away from depending on your presence to sleep, and that it's okay that he needs you. Just try to redirect it to anohter manner of finding comfort...it will be okay.
Congrats on the baby...Good Luck!
Deanna