Financials were up on hopes that the central bank may ease key policy rates at its policy meet next week while telecom shares firmed up on reports that they have hiked voice call tariffs for mobile phone services.
The 30-share Sensex ended up 45 points at 20,027 after touching a high of 20,058 and a low of 19,920.
The 50-share Nifty ended up six points at 6,054 after touching a high of 6,070 and a low of 6,021.
Meanwhile, the broader markets closed in the red with both the midcap and the smallcap indices losing 0.8% each.
In Asia, the Nikkei average fell a third straight day, reaching a three-week closing low on Wednesday after the Bank of Japan's easing steps fell short of expectations, triggering profit-taking in shares bought in anticipation of the central bank decision.
The Nikkei dropped 2.1 per cent to 10,486.99, logging its biggest one-day percentage fall in a week.
Hong Kong shares slipped from a 19-1/2-month high on Wednesday, pulled down by weakness among growth-sensitive counters as benchmark indexes faltered at chart resistance levels after a strong start to the year.
The Hang Seng Index closed down 0.1 per cent at 23,635.1 after closing on Tuesday at its highest since June 1, 2011.
However, The Shanghai Composite Index gained 0.3 per cent.
European markets slipped after the initial optimism about upbeat corporate earnings. FTSE, CAC and DAX slipped between 0.1-0.7%.
Back home, among the sectoral indices, banks and Capital goods edged higher and closed up 0.8% and 0.2% respectively.
All the other indices were in the red with Realty, PSU, Consumer durables, Auto, Metal and Oil & Gas down 0.5-2%.
The draggers in the realty space were HDIL which plunged 14% as the real estate developer sold part of its holding via open market transaction on Tuesday.
Unitech, Oberoi Realty, Sobha Developers and DLF slipped 0.7-1%.
All the
HUL's royalty increase catches flak
HUL logs Rs 871-crore profit; to pay Unilever more
Markets end lower, FMCG weighs
These are challenging times: HUL chief
4 stocks that gave positive returns since 2008