Once harvested, winter squash and pumpkins will usually store for several months. But you do need to keep it in the right place, which is not a cold, dark & damp shed!
Try to harvest them once the leaves die back, the stalk has turned brown and the skin has fully hardened, as this will help them to last longer. When harvesting, you want to keep as much of their stalk as possible, so cut a little further up the stem where it is softer.
Once harvested, store them inside on a sunny, warm windowsill. Their skin will further harden for a week or so. They can stay there for as long as you like really, but if you need your windowsill back then move them somewhere more convenient, but keep them in a warm, dry place that gets some daylight. Don’t put them in a cold, damp shed or store them under the stairs!
Kept like this, you should be able to keep them until next spring so that you can enjoy your harvest throughout winter… Good luck!