Oil gains on OPEC deal optimism