O2 sensor is responsible for measuring oxygen levels in the exhaust system of a vehicle to regulate fuel injection.