The Sensex and Nifty notched up gains for the fourth consecutive session on Thursday as monthly derivatives expired amid a largely positive trend in global equities after the US Fed reiterated its dovish stance.
A strengthening rupee also bolstered investors' sentiment, analysts said.
After touching the 50,000-mark in opening trade, the 30-share BSE Sensex pared some gains before ending at 49,765.94, up 32.10 points or 0.06 per cent.
Similarly, the broader NSE Nifty advanced 30.35 points or 0.20 per cent to 14,894.90.
Bajaj Finserv was the top gainer in the Sensex pack, rallying 6.60 per cent, followed by Bajaj Finance, Axis Bank, Reliance Industries, IndusInd Bank, Dr Reddy's and Sun Pharma.
On the other hand, HDFC, HCL Tech, Bajaj Auto, L&T, SBI and M&M were among the major laggards, dropping up to 1.76 per cent.
"The domestic market was torn between negatives and positives on volatile trade owing to the monthly F&O expiry. The Fed in its meeting sealed economic confidence by keeping its monetary policy loose and reaffirming aggressive support through bond buying.
"Metal stocks continue to outshine other sectors on strong outlook," said Vinod Nair, Head of Research at Geojit Financial Services.
Sector-wise, BSE metal, basic materials, energy, oil and gas and healthcare indices ended up to 5.23 per cent higher, while auto, telecom, capital goods and consumer durables finished in the red.
In the broader markets, the BSE midcap index slipped 0.18 per cent, while the smallcap gauge inched up 0.13 per cent up.
Meanwhile, India saw a record single-day rise of 3,79,257 new coronavirus infections, pushing the total tally of COVID-19 cases to 1,83,76,524, while active cases crossed the 30-lakh mark, according to the Union Health Ministry data updated on Thursday.
Global markets extended their gains after the US Federal Reserve maintained rates at near zero and continued its bond-buying programme, with Fed Chair Jerome Powell saying it was too early to consider rolling back support measures to boost economic recovery.
Elsewhere in Asia, bourses in Shanghai, Hong Kong and Tokyo ended on a positive note, while Seoul was in the red.
Bourses in Europe were largely trading with gains in mid-session deals.
International oil benchmark Brent crude was trading 1.36 per cent higher at USD 67.69 per barrel.
The rupee rose by 29 paise to close at 74.07 against the US dollar, extending gains for the fourth straight session.
Foreign institutional investors were net buyers in the capital market as they purchased shares worth Rs 766.02 crore on Wednesday, according to exchange data.