Oil futures end with a minor gain Wednesday, just barely notching a three-week high as traders weigh support from a fourth-straight weekly decline in U.S. crude supplies and escalating tensions in the Middle East against pressure from unexpected increases in petroleum-product supplies.