The science of slit eyes
Why do I see things clearer when I slit my eyes?
If you are near- or far-sighted, you see things clearer with slit eyes, i.e. when your eyes are nearly closed. It can be explained with ray diagrams found in secondary-school textbooks. In the case of near-sightedness:-
The image of an object produces a blur, not a point, on the retina. However, the blur diminishes when you slit your eyes:-
Similarly, for the case of far-sightedness:-
The above also explains why, when taking a photo with a camera, sharper images can be obtained with a reduced aperture. For the same reason, a pin-hole camera can produce amazingly sharp images.
Does that explain why I see better under sunlight?
Yes. In sunlight, the eye's pupil becomes smaller as the iris contracts, i.e. the aperture is reduced. This produces sharper images. In dim light, the iris dilates and images become blurred.