Remember, The Stranger is a novella told in flashback. Meursault narrates it, as if from death row, where he no longer sees the sun at all, and this colors Meursault's use of symbolism. Whereas the sun should be a source of life, it becomes a symbol connected with death in hind sight.
In The Stranger, the sun is present whenever Meursault faces difficult decisions. It is an external force that pressures the narrator and others to, ultimately, make bad decisions. In a way, the sun represents the external forces that are placed on the individual during the moral decision-making process: religion, culture, social expectations, tradition, the justice system. One cannot make decisions in a vacuum; all these pressures weigh on him constantly, and Camus' use of the sun is a kind of amalgam of all these pressures.
In Camus' absurd universe, most people are faced with two paths: the one leading toward individual freedom (life) and the one leading toward mass conformity (death). The sun, in retrospect, is an oppressive representation of all the forces which limit one's individual freedom and ability to choose life over death.
For example, Merusault (and Perez) must walk in the oppressive heat during the funeral procession. No one would, under any other circumstances, dress in black and follow a dead body in the heat of day by choice; it is a cultural expectation. Perez even passes out from the walk of death. The sun is a way of underscoring the absurdity of the rituals of death. (Remember, in the end, Meursault will say that no one had the right to cry over his mother's death.)
The sun is also present on the beach with the Arab. Here, the sun light off the blade of the knife is a stabbing reminder of the external forces placed on the individual: Meursault feels compelled to shoot out of self-defense, or revenge, or hatred of Arabs. It's as if all the forces of society are aligned against the individual in this showdown, and one's choice to not shoot or shoot once or five times is the choice between life and death.
Contrast this with Meursault's freedom in the next chapter where he goes to the beach and swims with Marie. The sun (and water) is a symbol of life and freedom, and Meursault relishes it against his body. In the "Myth of Sisyphus," a similar story, Sisyphus puts death in chains so that he can see his wife, the curve of the earth, the sun, and the water again. He chose freedom over death, and the sun stands in sharp contrast to the shades of Hades.