D.A.
I’m not sure if at 4 months it’s a habit just yet. He just sleeps better next to his Mommy. Some babies are like that =-) I know! My son was the same way!
Either way it will take a bit of time to get him to want to sleep all alone in his crib. Patience right now IS a virtue! First step is probably just NOT taking him back to bed with you. Do you have a chair in his room? When he wakes maybe you can rock him or just pat his back a bit?
I’m not an advocate of the crying it out method so I cannot advise you there.
Sorry that’s all I’ve got!