Mumbai: The Sensex and the Nifty, which spent the entire session mired in the red, recouped their losses to end flat on Friday. The BSE Sensex closed the session down 0.02 per cent or 5.83 points at 28,879, while the Nifty clolsed up 0.02 per cent or 2 points at 8,780. The majority of the sectoral indices finished in the green, with real estate (up 0.74 per cent) and metals (0.72 per cent) the top gainers. The other indices that made gains included oil and gas index, up 0.48 per cent, technology (0.48 per cent) and FMCG (0.24 per cent). Among the losers were healthcare (down 0.19 per cent), banking (0.35 per cent), and capital goods (0.31 per cent).