When you point a camera at the setting sun, the light meter inside automatically chooses an exposure that will capture every bit of detail in the sky. In doing so, it often chooses an f-stop and shutter-speed combination that is substantially darker than it needs to be, resulting in an underexposed image. To compensate for this on a DSLR, use your exposure-compensation dial (usually denoted by a +/- symbol) and adjust it to +1. In doing this, you're telling the camera to brighten the exposure by one stop. If that's not enough, try going up to +2.