Benchmark indices ended higher on Wednesday boosted by gains in oil and gas, banking, metal, capital goods and auto stock. The market took a U-turn in the last hour of trade after remaining in the green for the rest of the session. Nifty ended at 21,840, rising 97 points and Sensex gained 267 points to 71,822.