Oil retreats after longest run of weekly gains in three years