Gains in Sun Pharma, Tech Mahindra and HDFC were offset with losses in Reliance Industries, Bajaj Finance and State Bank of India.