U.S. stocks gained Thursday, bouncing back from a two-day rout, after the price of U.S. crude reversed higher, easing concerns for investors looking for oil prices to steady, and Federal Reserve Chair Janet Yellen's reported comments offset rate worries.

"Stabilization in the energy commodity, that's going to help everybody psychologically," Art Hogan, chief market strategist at Wunderlich Securities.