Is yours a v1 iPhone? If so, the proximity sensor (turns of screen when you hold it to your ear) and the ambient light sensor are located there:
600px-Iphonesensors.jpg
On the 3G and S they are to the left of the slotted earpiece. The proximity sensor glows light red when it is on; usually when you have the phone next to your face or otherwise have the sensor covered. Could it be that your sensor is shot? Does the screen still turn off when you cover the sensor with your hand?