Won't sleep

Jasmine

So im struggling a bit. My 5 month old use to co sleep well kind of in a cosleeper for about the first month. Than he went to his bed. In which he did great some nights sleeping 5 to 6 hour stretches. I think a few nights even like 8 hour stretches. Well since about 4 months he will not sleep on his bed. He wont even fall asleep in there. Im debating buying a different mattress because if I have him in his bed he'll sleep for an hour at max. Wake up crying every time. I try and see if he'll just go back to sleep but he won't.. if I move him to my bed he'll atleast sleep around 2 hours and 50 ish minutes max. But like when does this stop. Do u think a different mattress would do any good. I hope hell go back to sleeping good like before. Its just crappy because I don't understand why he sleeps way longer in my bed but as soon as he's in his he won't stay asleep for long. Most nights I'll put him in his bed and within a half an hr he's awake. If I let him stay asleep in my bed. Hours go by.