Why does squinting help you see more clearly?

Pin hole effect. Squinting narrows the opening of your eye and blocks off light rays coming from the side but allows those coming straight to the eye to enter the eye without being refracted (derviated). This creates a pin hole effect -like you are peeping through a tiny hole.