The U.S. Federal Reserve said on Wednesday the economy was showing signs of leveling out after 20 months of recession and it will extend the duration but not the size of a program to buy long-term government securities to minimize any disruptions from completing it.

The U.S. central bank also kept its benchmark short-term interest rate steady near zero and said it would likely stay there for an extended period.

To promote a smooth transition in markets as these purchases of Treasury securities are completed, the committee has decided to gradually slow the pace of these transactions and anticipates that the full amount will be purchased by the end of October, the Fed said in a statement at the conclusion of its policy-setting meeting.

The Fed launched the debt buying program in March when it had already chopped interest rates to zero but wanted to open the money taps even wider to support the struggling economy. Treasury purchases were previously scheduled to expire in September.

They see the worst with the economy is behind us but they don't want to jump the gun and pull back quickly, said Craig Thomas, a senior economist at PNC Financial Services in Pittsburgh.

U.S. Treasury prices fell after the Fed statement in apparent disappointment that the Fed did not increase the amount of debt that it plans to buy but subsequently regained some ground.

However, major U.S. stock indexes extended gains and the dollar rose against the yen.

The Fed slashed interest rates to a range of between zero and 0.25 percent in December and has pumped hundreds of billions of dollars into financial markets to stimulate economic activity in the worst recession in decades.

The economy has shown signs it is coming out of its swoon and job losses, which have already topped 6 million, may be moderating.

The Fed gave its clearest statement to date that it sees the recession nearing an end and that shattered financial markets are healing.

Information since the Federal Open Market Committee met in June suggests economic activity is leveling out, the Fed said. Conditions in financial markets have improved in recent weeks.

It is the first time since August 2008 the panel's statement has not characterized the economy as contracting, weakening or slowing.

The Fed in July forecast that growth would return in the second half of the year after contraction in five out of the last six quarters, but cautioned that unemployment should stay high well into 2011.

In its statement, the Fed renewed its warning that economic activity is likely to stay soft for a time. Household spending, while stabilizing, is still weak as a result of the grim labor market and tight credit, the Fed said.

The Fed renewed its pledge to keep rates exceptionally low for an extended period.

To quell worries the Fed's bloated balance sheet may sow the seeds of dangerous inflation once the recovery gains traction, Fed Chairman Ben Bernanke has taken pains to explain the Fed's tools to pull money out of the financial system to prevent price pressures from rising.

(Editing by Neil Stempleman)