IT, realty, and energy stocks posted gains, while pharma and auto stocks continued their downward trend, closing in the red.