How many drive cycles takes for engine light to go off after repair?

The check engine light should be turned off by whoever scans the DTC trouble code (and, records it). The car is, then, driven until the check engine light returns (or, not). The engine computer is scanned, again, and any DTC trouble codes recorded. Appropriate repairs are made, and the DTC trouble codes are erased. The car is driven, again, to see if the check engine light returns. If none does, the car is driven several “drive cycles” to allow the monitors to run their system sensor and actuator “health” checks. The monitors check just to insure that the sensors and actuators are ready to sense and to actuate.

Toyota has a 23 page TSB (Technical Service Bulletin), dated Feb. 8, 2002, “Readiness Monitor Drive Patterns”. It has lots of good stuff.