Bedtime

When my little boy sleep in his cot he’ll wake up after 4 hours but when he sleep in my bed he could sleep all night he is almost 1 what can I do to make him sleep better in his cot