The BSE Sensex shed its early morning gains to close 164.27 points higher at 38,837.18 on Monday. The 31-share index had crossed 39,000 points to touch an all-time high in early morning trade. The NSE Nifty too shed its early gains to close 45.25 points ahead at 11,669.15 on Monday.

Share markets were lifted by sustained buying, mainly in metal, auto and financial stocks, and positive cues from global markets, PTI reported.

The top gainers on the Sensex were Tata Motors, Vedanta, Bharti Airtel, Tata Steel and Maruti Suzuki. The gains on the Nifty 50 were led by Tata Motors, Hindalco, Tata Steel Wipro and Maruti Suzuki.

The biggest losers on the Sensex were IndusInd Bank, Mahindra and Mahindra, Axis Bank, Power Grid Corporation and HDFC. On the Nifty, the stocks which declined the most were Zee Entertainment, UPL, Indian Oil Corporation, Eicher Motors and IndusInd Bank.

The foreign exchange markets were closed on Monday because of annual account closing of banks. The rupee had closed at 69.15 per dollar on Friday.