This is because rocks (including sand) have low heat capacities (the amount of energy needed to raise their temperature). This means that they heat up easily during the day, and cool down quickly during the night. If the entire Earth was like that, it would be very hard for life to exist due to the extreme temperature differences that would occur. Luckily, the oceans come to the rescue. Water has an abnormally high heat capacity, and so heats up slowly during the day, and releases that heat slowly during the night. This makes for fairly constant temperatures, which help regulate the climate to keep it stable.
Answer provided by Dr. Universe