The iPhone 3Gs third sensor has been confirmed as a second proximity sensor, according to an iLounge report.
"While the original iPhone offered only two front-mounted —one ambient light sensor and one proximity sensor—the iPhone 3G sports an array of three sensors (two proximity sensors, one ambient light sensor) in a J shape to the left of the ear speaker, moved from their original locations above and to the speaker’s right."
The third sensor was added to provide improved face proximity detection.