Mid-cap shares witnessed buying interest as the S&P BSE MidCap Index rose 0.4 per cent.

The S&P BSE Sensex and NSE Nifty 50 Indexes rose for second day in a row led by gains in energy, power and oil & gas shares. Earlier in the day, Sensex and Nifty opened on a flat note and fell in the late morning trades after shares like Yes Bank, Tata Motors, Sun Pharma, Hero MotoCorp and Bajaj Auto came under selling pressure. However in noon deals, the benchmarks again reversed their direction led by buying interest in HDFC, Infosys, Reliance Industries, ONGC and Bharti Airtel. In today's trade, Sensex moved in a range of over 300 points while the Nifty touched high of 11,917.45 and low of 11,814.70.

The Sensex ended 0.33 per cent or 129.98 points higher at 39,816.48 and the Nifty advanced 0.38 per cent or 44.70 points to close at 11,910.30.

Fifteen of 19 sector gauges compiled by BSE ended higher led by the S&P BSE Oil & Gas Index's 1.1 per cent gain. Energy, Power, Information Technology, Telecom and Utilities sector gauges also rose between 0.7 and 1 per cent each.

On the other hand, S&P BSE Realty Index was top loser, down 1.8 per cent.

Mid-cap shares witnessed buying interest as the S&P BSE MidCap Index rose 0.4 per cent.

UPL was top gainer in the Nifty 50 basket of shares, up 4 per cent at Rs 657.25. Indiabulls Housing Finance, ONGC, Eicher Motors, Indian Oil, HDFC, Bharti Airtel, Coal India and Infosys were also among the gainers.

On the flipside, Yes Bank was top loser, the stock fell 8 per cent on the back of heavy volumes. Over 90 lakh shares changed hands on the BSE compared with an average of 62.71 lakh shares traded daily in the past two weeks.

Tata Motors dropped 3 per cent to Rs 163.35 after its sales in domestic market fell 14 per cent to 49,073 units in June.

Sun Pharma, IndusInd Bank, Dr. Reddy's Labs, Hero MotoCorp, Axis Bank and Bajaj Auto also ended lower between 1 and 2.2 per cent each.