Markets consolidated further for yet another day and ended marginally higher on Friday. The BSE Sensex ended at 40,685.50, gaining 127.01 points or 0.31%. The Nifty closed at 11,930.35, up 33.90 points or 0.28%