Does the sun have a protective layer that at least diminishes its radiation. I know the earth's atmosphere protects us from harmful rays. But does the sun have a sort of shield as well that if removed would radiate more heat.
You seriously cannot expect the sun to have a layer that would contain some of its harmful radiation. Sun consists of a plasma and is not solid. Learn more about its structure here. Magnetic field is a kind of layer you might think of apart from all gases and energy it radiates. But that is harmful and not protective for us. It is highly unlike earth which has a solid crust. Any layer around sun wouldn't actually protect us as it would have to contain a huge amount of energy and that would make it more unstable.
Earth just happens to be at the right distance from the sun that was conducive enough to harbor a suitable atmosphere with just the right combination of the right elements and compounds (especially oxygen for breathing, ozone for protection and nitrogen for maintaining atmospheric balance). This is why life has been possible here. Earth also happens to have a magnetic field strong enough to protect us from the solar wind, as described in details here. It just diverts the harmful energy away from us. Containment of huge amount of energy is the major concern here and nobody is doing that.
So life has been possible only because the way earth has been created, well of course all energy comes from the sun. But the sun just provides energy and doesn't save us from itself.