fading display on iPhone 3GS
Have you checked that Auto Brightness is on?

Go to settings>brightness you then have a slider to change the brigntness of the screen and the auto brightness switch.

If this is on, it uses the light sensor by the camera to adjust the brightness with the ambiant light.