Ideally, you should harvest your squash on a dry day. It is best to use a sharp knife and to leave an 8 to 10 cm (3 to 4 inch) stem, because you could damage the stem and cause the fruit to rot if you just tear the squash off the plant.
For the same reason, you should never carry a squash by the stem. Avoid bruising it, too, or it could spoil. Damaged squash should not be stored with healthy specimens.
All types of squash benefit from being left in the sun to dry for a few days, and this will help them keep longer. You may wish to spread them on trellis made of snow fencing or chicken wire to encourage better air circulation. Leave enough space between them, as well.
Once the stem is completely dry, store your squash in a cool spot, preferably at 13-18°C (45-50°F).
Afterward, you should be able to keep your ornamental squash fairly well indoors.