There has always been a great discussion about why dogs like to sunbath, and interestingly there is some argument about whether dogs get vitamin D from sun exposure like humans do. Lets dive in a bit deeper into this topic.
I believe that dogs does not produce sufficient vitamin D from sunlight exposure to sustain their daily needs, and they need to rely on dietary cholecalciferol. However, I think not enough studies have been done on all breeds of dogs, which I am pondering if less furry breeds/certain breeds has more Vitamin D precursor in their skin compared to others. With that being said, even if some breed do have higher precursor and able to synthesize more vitamin D in the skin after sun exposure than others, I doubt that it is enough to meet their metabolic requirement.
Theoretically, the pathway of serotonin production from sunlight exposure are the same for all vertebrates which include humans and dogs. There is currently no research (that I can find) which is able to prove that more sunlight exposure in dogs are associated with more serotonin production, easily because serotonin is also influenced by a lot of other factors, such as olfactory stimulation, food, companion etc. However, I think dogs definitely benefit from sun bathing and have reduced stress level, no only due to serotonin production but also other factors listed below.
Another interesting topic which is related to sun exposure is that sunlight helps to reduce shedding in dogs. After hours of research and reading, I have come to a conclusion that, the pathway is still unknown, as again it is influenced by too many other factors.
"The coordination of the HC phases and the SC activity is dependent on complex interactions between signals of the follicular (niche components) and dermal microenvironment (e.g., keratinocytes, fibroblasts, adipocytes, immune cells, and nerve fibers), macroenvironmental factors (e.g. hormones, genetics, and age), and environmental factors (e.g. daylight, nutrition, and circadian rhythm) (Chen et al. 2015; Chen and Chuong 2012). By now, the molecular and cellular composition of the HF-SC niche in the mouse has been well characterized. The state of the murine HF is mediated by a complex interplay between transcription factors implicated in, as well as proteins belonging to, several signaling pathways, including the Hedgehog, Wnt/β-Catenin, transforming growth factor (TGF)-β, BMP, and Notch pathways (reviewed in Lee and Tumbar 2012). However, the understanding how the niche elements work together and how they interact with macroenvironmental and environmental factors to initiate and promote a new HC and thus to regenerate a new HF is still not complete."
To understand the whole process we have to understand how the canine hair follicle and cycles work, which is very complex and as quoted above by the researcher who published this article. I attached the link for those who are interested to read more.
https://journals.sagepub.com/doi/full/10.1177/0192623316631843
If shelter and adequate clean cool water is provided, our dogs usually are smart enough to move away from the sun when they 'had enough'. However, in cases where they cannot choose, eg. left in the field without shelter, heat stroke would be the biggest concern, though easily avoided. Panting excessively, hypersalivation, injected mucous membrane (red instead of pink), losing consciousness, and even seizures are common signs for heat stroke and should be taken seriously. For light-haired or light-colored animals, they have increased risk of skin cancer such as melanoma and sunburn concern.
Pet safe sunscreens are formulation that protects the fur babies from UV but doesn't contain toxic substances such as zinc oxide or para-aminobenzoic acid (PABA) which is often found in human sunscreen. Dogs with high risk of having skin cancer and sunburn are encouraged to use these sunscreens. Below are some links if you want to know more about pet safe sunscreens and their benefits.
https://veterinarypartner.vin.com/default.aspx?pid=19239&id=4952515#:~:text=Sunscreen%2C%20or%20sunblock%2C%20can%20be,or%20SPF%2030%20for%20humans.