We address the traffic light control problem by developing a Stochastic Flow Model (SFM) for an intersection and using a policy based on partial state information defined by detecting whether vehicle backlogs are above or below certain thresholds. Using Infinitesimal Perturbation Analysis (IPA), we derive online gradient estimators of an average traffic congestion metric with respect to the green and red cycle lengths and to the backlog thresholds. The estimators are used to adjust light cycle lengths and thresholds so as to improve performance and to seek optimal values which adapt to changing traffic conditions.