NEW YORK (AP) _ Stocks ended at record highs Friday after swinging widely with bonds.

The Dow Jones industrial average closed up 22.03 points at 5,630.49, its second consecutive record. The blue-chip index rose more than 50 points in the first hour of trading, triggering the New York Stock Exchange's imposition of a limits on computer-driven trading. It fell to a loss of 48 points in the afternoon before regaining its footing.

``The volatility has become extremely intense,'' said James Solloway, research director at Argus Corp. ``My one suggestion is that everybody in the world buy (Eli) Lilly stock, because they are the makers of Prozac, and everybody's becoming somewhat manic depressive.''

Broad market indexes ended narrowly mixed. The Nasdaq composite rose 0.68 to 1,117.79, its third consecutive record.

The NYSE composite rose 0.09 to 350.94, and the Standard & Poor's 500 composite rose 0.22 to 659.08. But the American Stock exchange market value index slipped off Thursday's record high, losing 0.89 to 569.27.

On the Big Board, declining issues led advancers by better than 9 to 8. Volume totaled 439.14 million shares as of 4 p.m. behind Thursday's pace.

Early in the session, ``there was just a huge follow-through in the equity market'' after Thursday's 92-point leap in the Dow average to record highs, said Arthur Hogan, the lead stock trader at Dean Witter Reynolds Inc.

``For a while it looked like there just didn't seem to be a top, but they put the brakes on it pretty quickly.''

Stocks were stopped in their tracks by the bond market, which first rose about 5/8 point but quickly dropped into negative territory.

The 30-year Treasury bond ended the day down more than a point and yielding 6.4 percent, pushed lower after stories circulated, and were later confirmed, that Morgan Stanley had urged investors to short bonds. In a short sale, a trader sells a borrowed bond and hopes its value falls before he or she has to buy it back to complete the transaction.

Bonds rose early in the session, pushing stocks with them, after the Commerce Department said the nation's economy expanded by just 2.1 percent for all of 1995 and an anemic 0.9 in the fourth quarter, just half of what private economists had been expecting.

The slowdown reflected sluggish consumer spending, which accounts for two-thirds of the total economy. In the fourth quarter, consumer spending rose at an annual rate of 0.8 percent, Commerce said.

But bonds backed off after the Commerce Department said U.S. housing starts climbed 4.4 percent in January, much higher than analysts had predicted, to an annualized rate of 1.45 million units.

Meanwhile, technology stocks retreated early in the day from spectacular run-ups earlier this week, but finished mixed.

On the Big Board, Micron Technologies fell 1 1/8 to 37 5/8 in leading volume. Hewlett-Packard ended up 1/4 at 103 3/8 after dropping more than 2 points when Salomon Brothers downgraded it.

IBM continued to climb, finishing up 1 1/2 at 125 5/8. Compaq rose 5/8 to 51 7/8 after settling a lawsuit with closely held Packard Bell.

In Nasdaq trading, Dell Computer fell 1 1/4 to 35 1/2. The personal-computer maker said fourth-quarter earnings rose 17 percent but lagged a 49-percent jump in sales.

Oil stocks were sharply lower as oil futures fell on profit-taking. Exxon fell 1 1/4 to 82 1/4, Chevron fell 7/8 to 57 1/4, and Texaco lost 1 1/4 to 81 5/8.

Transportation stocks fell, correcting for huge run-ups earlier this week.

The Dow Jones transportation average lost 7.34 points, or 0.35 percent, to 2,104.03. But AMR, part of the transportation index, rose 1 7/8 to 89 1/2, after Salomon Brothers upgraded the stock, saying the airline holding company was ``about to start a process which will maximize shareholder value.''