U.S. chipmaker Micron Technology Inc posted a narrower-than-expected quarterly loss as improving demand boosted sales and prices, but its shares gave up initial gains as investors locked in profits.

Some analysts said investors were also disappointed that the company did not give any indication that it expected chip prices to continue to recover.

Micron executives said memory chip supply and demand would be roughly balanced for the rest of calendar 2009 as the industry emerges from its worst downturn in decades.

Wedbush Morgan Securities analyst Betsy Van Hees said rising chip prices in recent months had encouraged investors to look for a stronger recovery than the company suggested.

Micron's shares rose more than 3 percent in after-hours trading before slipping to $8.40, their regular session close.

The stock has tripled this year.

Given the improvement in memory prices, the expectation was that they would outperform the general consensus, Ragen MacKenzie analyst Taunya Sell said, adding that the stock has had a nice run in the last few months.

Investors had factored in a bounceback in demand for Micron and its rivals, Samsung Electronics Co Ltd <005930.KS> and Hynix Semiconductor Inc <000660.KS>.

The market, while still challenging, is beginning to improve, Micron Chairman and Chief Executive Steve Appleton said in a statement.

Micron, which makes memory chips used in computers, cell phones and digital music players such as Apple Inc's iPods, said sales of its DRAM memory chips rose 28 percent in the fourth quarter ended September 3 compared with the third quarter.

That reflected a 19 percent increase in sales volume and an 8 percent rise in average selling prices.

Sales of higher-end NAND flash memory increased 10 percent from the previous quarter on a 23 percent climb in volume.

Micron reported a quarterly net loss of $88 million, or 10 cents per share, compared with a net loss of $344 million, or 45 cents per share, a year earlier.

That was better than a loss of 18 cents a share expected on average by analysts, according to Reuters Estimates.

Revenue fell 10.1 percent to $1.3 billion, and was slightly above the $1.28 billion analysts had expected.

(Reporting by Clare Baldwin and Ian Sherr; Editing by Gary Hill and Ted Kerr)