The Nifty 50 gained 126.75 points or 0.51% to close at 25,175.40, while the Sensex rose 319.78 points or 0.39% to settle at 81,857.48