The benchmark indices ended on a positive note on Friday after two consecutive sessions of losses, lifted by a sudden surge in the last 15 minutes on a day when the indices remained rangebound for the majority of the duration. The S&P BSE Sensex ended at 38,862.23, up 177.51 points, or 0.46 per cent, with Tata Steel being the top gainer and State Bank of India being the biggest loser. About 1,500 shares advanced, 1,049 shares declined, and 165 shares remained unchanged. The NSE's Nifty50 index closed above 11,650 level at 11,665.95, up 68 points, or 0.59 per cent. Metal stocks advanced the most, followed by realty and IT counters. The Nifty Metal index ended almost 2 per cent higher at 3,132.35. On a weekly basis, the S&P BSE Sensex ended 0.49 per cent higher while the NSE Nifty 50 gained 0.36 per cent on a weekly basis. In the broader market, the S&P BSE Midcap index surged 97 points or 0.63 per cent to close at 15,509. The S&P BSE SmallCap rose 108 points or 0.72 per cent to end at 15,046. Shares of Godrej Properties surged 6 per cent to hit its fresh high of Rs 968 in early morning trade on the BSE on Friday after the Mumbai-based real estate developer announced the addition of a new residential project, in Vashi, Navi Mumbai. The stock ended the day at Rs 978.45, up 7.02 per cent. Lakshmi Vilas Bank shares were locked at 5 per cent upper circuit, at Rs 92.75, for the second straight day, in intra-day trade on the BSE after reports of a merger with Indiabulls Housing Finance. Shares of sugar companies rallied by up to 16 per cent on the BSE in intra-day trade on Friday. Shree Renuka Sugars and Mawana Sugars have rallied 16 per cent and 14 per cent, respectively, on the back of a two-fold jump in trading volumes.