whats the medium in the space, and How does sunrays enters in to the earth.

The atmosphere is transparent at some wavelengths, and opaque at others. Transparent just means that the light waves can simply pass through the atmosphere unimpeded by the particles that are present. (They interact with these particles and are slowed by them, but their progress is not stopped entirely).

Light requires some medium to pass through, whats the medium in the space

That medium used to be known as "aether", and its existence was experimentally refuted in the 19th century. Modern physical theories believe that light propagates through the space without any other media.

Light is electro-magnetic waves. If you really must have a medium, it is the electro-magnetic field which, at every point in space is the vector sum of all electric and magnetic forces from all objects in the universe.