Why does squinting help you see more clearly?
In normal vision, you can focus clearly from five or ten centimeters in front of the face on off to infinity. With corrected vision, glasses, contact lenses, or what have you, this close focal length can be a lot more variable, especially after aging does further damage to close vision. Uncorrected nearsightedness is even worse, with both up-close focus and far-away focus broken -- leaving the whoever is seeing with only a small interval of distance in which things are clear.
From photography, we know that to increase the depth of focus, we must decrease the diameter of the aperture which allows in light, i.e. go down an f-stop or two. Squinting is the same principle at work in vision. When you close your eyes to a great enough degree that less light is allowed in than through whatever your pupil diameter, you've effectively stopped down your eyes' lenses. Thus, you can see things both closer than normal and (in nearsightedness) farther away.
Notably, because it is entirely an optical phenomenon, squinting will not do any permanent damage to your vision, though doing enough of it may well give you a wretched headache. Also, some guardians of ophthalmological knowledge suggest that it is wrong wrong wrong to call this a squint, because that piece of jargon is reserved for describing lazy eye. They would prefer you to call this a narrowing of the palpebral aperture. Unfortunately for those suckers, English has moved on without them.