U.S. stocks rallied Friday, helping major indexes notch a second consecutive week of gains, buoyed by optimism that parts of the American economy may begin reopening in coming days.

The Dow Jones Industrial Average 705 points, or 3%, led higher by shares of Boeing. The S&P 500 added 2.7%, and the Nasdaq Composite added 1.4%.

The gains...