The Sensex rose by 50.54 points, or 0.26 per cent, to 19,764.78, a level last seen in January 2011. The index had gained 288 points in last two sessions.
Similarly, the broad-based National Stock Exchange index Nifty ended 16.25 points up, or 0.27 per cent, to 6,009.50, for the first time in two years.
Brokers said trading sentiment bolstered after the US Congress passed the "fiscal cliff" deal besides a better US manufacturing data boosting investor confidence.
They said the market was further supported by Asian stock rising to 17 months high and European market opening firm following reports of expansion in China's services industries raising hopes of faster global economic recovery.
The upsurge was led by stocks of software exporting companies as country gets over 60 per cent of their revenue from the US and European markets.
Besides, expectation of attractive quarterly results by IT major Infosys next week and interest rate cut by the Reserve Bank of India later this month boosted the sentiment, they added.
More From This Section
"Markets consolidated after recent rally, but inched higher to close above 6,000 mark led by gains in IT and Oil & gas stocks. Throughout the day, profit-booking was visible in banking stocks and momentum shifted to mid cap and small cap counters," says Amar Ambani, Head of Research, IIFL.
In the 30-BSE index components, 14 stocks gained led by the two most-heaviest - Reliance Industries and Infosys. The two stocks carry nearly 18 per cent weightage on the benchmark.
The Oil and Gas sector index gained the most by rising 1.37 per cent to 8,763.88 followed by TECk index by 1.32 per cent to 3,491.06. IT index rose by 1.10 per cent to 5,744.07.