Wall Street has gained for a fourth straight session, its longest winning streak since January, buoyed by the energy sector.