Transitioning baby to their own bed

I am in need of desperate advice. My son who is 2 years old has been Co sleeping with me. But he has also sleepy in his own bed. Now I can get him to sleep for at least a few hours in his own bed but he always wakes up and comes into my bed. How can I get him to stay in his bed and sleep by his self. I really would like to get him to sleep alone