The shooting happened at 8:35 p.m. in the 2700 block of Iowa Avenue near the 215 Freeway, Colton police said. The officer was approached by the suspects, who opened fire and fled.
Christopher Marquez, 24, and Anthony Gomez, 31, both of Riverside, were booked for attempted homicide. Their bail was set at $1,000,000.
Both suspects are scheduled to appear in a San Bernardino courtroom on Tuesday afternoon.
The officer, whose name has not been released, is in critical condition.
Police originally said there were four suspects, but they now believe only Marquez and Gomez were involved.