Yes, a bad O2 sensor can cause stalling in your vehicle. The O2 sensor measures the amount of oxygen in the exhaust gases, and this information is used by the engine management system to adjust the air-fuel mixture. If the sensor is malfunctioning and providing incorrect readings, it can lead to a too-lean or too-rich air-fuel mixture, resulting in stalling. Regular maintenance and timely replacement of O2 sensors can prevent stalling issues.