The benchmark indices extended gains for the third straight session to end at fresh closing highs, but the midcap and smallcap indices snapped two-session long rally to finish lower.
The S&P BSE Sensex ended at 31,109, up 81 points, while the broader Nifty50 settled at 9,604, up 10 points.
In intraday trade, the 30-share Sensex rallied as much as 186 points to hit its all-time high of 31,214, while the broader 50-share Nifty gained 42 points to touch its lifetime high of 9,637.
In the broader market, the S&P BSE Midcap and the S&P BSE Smallcap indices shed 1% and