Indian benchmarks logged record closing highs for the second straight session on Wednesday, led by gains in heavyweights Reliance Industries and private banks as investors looked for under-heated pockets for better valuations and safety.

The NSE Nifty 50 added 0.62% to 23,868.80, while the S&P BSE Sensex settled 0.8% higher at 78,674.25.

The Nifty has hit record highs in eight out of 11 sessions.

It has gained about 6% in June so far, on course for its best month this year, helped by policy continuity, forecasts for better economic growth and the return of foreign inflows.

Oil-to-telecom conglomerate Reliance, which has the second-highest weightage on the Nifty, rose 4.1% to hit an all-time high. It has risen about 2% this fiscal year, less than the Nifty's 7% increase.

"Earnings-wise, these large-cap conglomerates like Reliance, most of the public sector banks and large private banks are solid. Institutional money is chasing these segments," said Aishvarya Dadheech, founder and chief investment officer at Fident Asset Management.

ICICI Bank, the country's No.2 private lender by market value, rallied for the seventh session in a row. It added 1.7% on the day, helping private banks 0.6% higher.

Analysts have also said investors are rotating between sectors in search of valuation comfort and safety ahead of key events like the union budget and earnings season next month.

On the flip side, metals stocks shed 1.45% on soft global prices amid a strong U.S. dollar.

Vedanta declined 2.63% after its parent announced plans to sell a 2.6% stake to a group of institutional investors.

Small-caps rose 0.25% on the day, while mid-caps shed 0.22%. (Reporting by Hritam Mukherjee and Bharath Rajeswaran in Bengaluru; Editing by Janane Venkatraman, Mrigank Dhaniwala and Savio D'Souza )