Two ways, basically.
One's HDR. You adjust brightness of the image according to the brightness of the image (if that makes sense). It's somewhat hard to control and might not work exactly the way you want. The implementation is somewhat hard to do, too.
The other one's a simple sprite that gets brighter when the camera is further away and looking from the right direction. A very simple approach: additive rendering, one simple equation to control brightness, sprite must fit in the scene (where all sprites are sorted according to distance from camera).
You can find the performance of both techniques in different "parts" of Half-Life 2. The first can be found in "Lost Coast" while the second can be found in the original game, Half-Life 2 (the highway levels, to be specific), here's a video that displays this technique.