A late sell-off wiped out the stock market's gains Thursday as the stalemate over raising the country's debt limit continued.

The market had been up for much of the day after an unexpected decrease in new applications for unemployment benefits. Stocks sank in the last half-hour of trading after Senate Majority Leader Harry Reid said that a bill to end the stalemate, proposed in the House of Representatives, would fail if it reached the Senate.

"That gave a catalyst for selling," said Quincy Krosby, market strategist at Prudential Financial.

The Dow has fallen five straight days because of worries that the U.S. might default on its debt if Congress doesn't raise the country's borrowing limit. It's down more than 484 points, or 3.8 percent. Just five days remain until the Treasury Department says the government won't have enough money to cover all of its bills.

Even if the U.S. doesn't default, investors worry that the country might lose its triple-A credit rating. That could raise interest rates and possibly slow the U.S. economy, which is still recovering from the worst recession in decades.

"We're running out of time," said Phil Dow, director of equity strategy at RBC Wealth Management in Minneapolis. "It's getting scary."

The chief executives of several of the country's largest banks sent a letter to The White House and to Congress urging a quick resolution to the debt limit debate. Bank of America Corp.'s Brian Moynihan, JPMorgan Chase & Co.'s Jamie Dimon, and Goldman Sachs Group Inc.'s Lloyd Blankfein and others warned on Thursday that the consequences on not acting would be grave for the economy, the job market, and for America's global economic leadership.

The Dow Jones industrial average fell 62.44 points, or 0.5 percent, to close at 12,240.11. The index had been up as many as 82 points earlier in the day.

The Standard & Poor's 500 fell 4.22, or 0.3 percent, to close at 1,300.67. The S&P 500 has four straight days. The Nasdaq composite index was up 1.46, or 0.1 percent, to 2,766.25.

The price of gold, which tends to rise when investors are fearful of economic disruptions, fell $1.70 to $1,613.40 an ounce. Gold is up $100 an ounce in the last two weeks and nearly $200 an ounce since the beginning of the year, when it traded at $1,422 an ounce. When gold prices are high, experts say it's a good indicator that people are reluctant to invest in other markets.

The dollar rose against other currencies. Treasury prices were also up slightly.

Markets declined less on Thursday than they did earlier in the week. That's partly because the government reported that first-time applications for unemployment benefits fell to 398,000 last week, the fewest in four months. Economists had expected 415,000 first-time applications for unemployment benefits. And any figure below 400,000 is typically associated with job growth.

Technology stocks rose after LSI Corp., which makes storage and networking chips, forecast revenues that were higher than investors were expecting. Its stock gained 14.1 percent, the most in the S&P 500.

Bristol-Myers Squibb Co. rose 1.5 percent after the drugmaker reported earnings that were better than analysts anticipated. The company also raised its earnings forecast for 2011.

Exxon Mobil Corp. fell 2.2 percent after its earnings came in below analysts' estimates.

Akamai Technologies Inc. fell 19.1 percent, the most in the S&P 500 index, after the online streaming company's earnings were lower than analysts had expected. Sprint Nextel Corp. fell 15.9 percent. The nation's No. 3 wireless carrier said its loss widened in the second quarter, partly because of a tax expense and investment losses.

The Dow is down 3.5 percent for the week and is headed for its worst week since last July. The S&P 500 is down 3.3 percent for the week, while the Nasdaq is down 3.2 percent. Still, the Dow is up 5.7 percent for the year, the S&P is up 3.4 percent for the year and the Nasdaq is up 4.3 percent for the year.

Nearly two stocks fell for every one that rose on the New York Stock Exchange. Volume was relatively heavy at 4.4 billion shares.