To begin with - if you get a choice - choose the largest, healthiest specimen that you can find, discarding anything that is showing signs of disease.
Once you are happy that the squash is ready, cut it open, scoop the seeds out into a sieve and rinse them under a running cold tap. This will wash off most of the fibrous, jelly like coating which covers them – this is there to prevent germination while they are still in the fruit.
Once clear of the fibrous jelly, spread the seeds out onto a china plate to dry - then after a couple of days turn them over. It is important to allow them to dry out thoroughly although this can a few weeks. This is important because you do not want the seed to rot while they are in storage.
Once properly dry, store in an air tight container and place in a cool dark place where they can remain viable for up to five years.