The University of Michigan’s consumer sentiment index rose to 55.2 from 49.5 in June as gasoline prices cooled.