American factories expanded for the third straight month in May, helped by a weaker dollar, the Institute for Supply Management said.