NEW YORK — U.S. stocks rallied to the brink of a record Thursday after more companies reported fatter profits than expected.