Oil prices gain with decline in US dollar index