Does the spin of the earth around its axis vary at different distance from the sun?,if so how does it correspond to the length of day and night,?
No, there's no relationship between the earth's rotational speed and its distance from the sun.
The earth follows an elliptical orbit around the sun, but from the earth's frame of reference, it's in freefall. Therefore, the earth's rotation is independent of its path through space.
The earth's rotation is actually affected by tidal effects from the moon (our rotation is slowing down), but this effect is too slow to have a noticeable impact on the length of our days and nights. (We add a leap second every few years to account for this)
The Sun does indirectly influence the length of day: it's not a gravitational effect, but a seasonal, as the temperature of the atmosphere changes throughout the year.
The rotation of the Earth changes over time, and in particular there are annual and semi-annual fluctuations (see wikipedia). This is caused by the exchange of angular momentum between the solid Earth and the atmosphere (and to a lesser extent, the oceans). The angular momentum of the atmosphere changes throughout the year; it is highest in January, when the temperature in the Northern Hemisphere is lowest. This causes stronger westerlies in the NH than in July, increasing the angular momentum of the atmosphere. Similarly the westerlies in the Southern Hemisphere are strongest in July and weakest in January. However, the effect is not as strong as in the Northern Hemisphere, because the larger landmass in the NH causes a higher temperature difference.
The net result is that the angular momentum of the atmosphere is larger in January than in July. However, the total angular momentum of the solid Earth + atmosphere (and oceans) is conserved: the solid Earth is spinning slower when the atmosphere is spinning faster, and vice verse. As a result, a day in January is longer than a day in July, although the difference is less than a millisecond.
Source: Atmospheric angular momentum and length of day, pag 14.