I had the speed control module replaced due to the check engine and trac light both were on. My xb died when these lights first came on. Since replacing the module my mileage has gone from@26 to 23.
gas mileage dropped on 2008 Scion xB
Do you remember what the specific code was that was stored? I have seen both the air flow meter and O2 sensor start to fail and get lazy and cause a drop in fuel mileage .The airflow meter can be tested using a scan tool and see what the scan tool reads as engine load when you floor the gas pedal. Air flow meter is often accompanied by a loss of power.