(a) Sayyiduna Abu Hurayrah (may Allah be pleased with him) said that Abu al-Qasim (peace and blessings be upon him) said: "When one of you is in the sun (and Makhlad said: in the shade) and the shade recedes from him, so that part of him is in the sun and part in the shade, let him get up."
(b) In the narration of Abu al-Munib al-Ataki, Abdullah bin Buraydah reports from his father, from the Prophet (peace and blessings be upon him), a prohibition of that. This may mean that he intended it so that one is not harmed by the heat of the sun.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجمعة / 5921
Sayyiduna Abu Hurayrah (may Allah be pleased with him) said: I saw the Prophet (peace and blessings be upon him) sitting in the courtyard of the Ka'bah, with part of him (peace and blessings be upon him) in the sun and part in the shade, and he had placed one hand over the other.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجمعة / 5922
Sayyiduna Abu Hurayrah (may Allah be pleased with him) said: "When one of you is in the shade and the shade shrinks away from him, let him get up, for it is the sitting of Shaytan."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجمعة / 5923
Isma'il bin Ibrahim bin Aban said: I heard Ibn al-Munkadir narrating this hadith from Sayyiduna Abu Hurayrah (may Allah be pleased with him). He said: I was sitting in the shade with part of me in the sun, and when I heard it, I stood up. Ibn al-Munkadir said to me: "Sit down, there is no harm on you; you simply happened to sit like this."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجمعة / 5924