All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
The child at this age is far from this feeling that you feel, and he is still below the age of being required to perform Islamic obligations. So you should not be harsh with him, nor hit him, for he is not held accountable for his actions. {C}
Nevertheless, he should be kept away from that place and accustomed to sleep alone so that sleeping with you would not have a bad impact on his behavior in the future. This is in addition to what you said about its bad impact on your feelings.
The best way to correct such behavior is as follows:
Try to accustom him to sleep on his own bed, because if a child is trained to do something, he gets used to it. It would have been better if you had started accustoming him at an early age, immediately after weaning, for instance.
If there is a need to advise him in this regard, it would be better at another time; for example, when going out for a picnic.
As for beating such a child, it may be a pure harm and useless; and it may have the opposite result, as he might become more stubborn. Slapping the face is especially forbidden.
Abu Hurayrah, may Allah be pleased with him, narrated that the Prophet said, “If one of you fights with his fellow Muslim, let him avoid (hitting) the face...”
An-Nawawi said, “The scholars said that this is an explicit statement about the prohibition of hitting the face, because the face is delicate and carries all beauty; its parts are gentle and precious, and the face includes most of the senses. Hitting the face may cause defect to the senses or impair them, and it may even cause deformity to it. Deformity in the face is a significant matter because it is visible and cannot be concealed. When the face is hit, it is hardly spared from suffering deformity...”
For more benefit, please refer to fatwa 340663 and 339625.
Allah knows best.