By Barani Krishnan

NEW YORK (Reuters) - Oil prices settled lower on Tuesday on profit taking after a two-day rally, then rose in post-settlement trade after data showing a larger-than-expected draw in U.S. crude stockpiles.

Crude inventories fell by 5.2 million barrels for the week ended June 17, the American Petroleum Institute (API) said. The trade group's figures were triple the draw of 1.7 million barrels forecast by analysts in a Reuters poll. [API/S]

The U.S. government's Energy Information Administration (EIA) will issue official stockpiles data on Wednesday. [EIA/S]

Early in the session, oil prices dropped as much as 2 percent as investors took profits on a two-day rally fed by speculation that Britain would not vote to leave the European Union in a referendum this Thursday. But a rebound in gasoline lifted crude off session lows, and oil settled the session only slightly lower. <RBc1>

Gasoline prices rose after Royal Dutch Shell Plc <RDSa.L> shut its gasoline-producing fluidic catalytic cracking unit at the 316,600 barrel per day (bpd) Deer Park, Texas refinery.

Oil prices were also supported by worries about the possibility of global crude supplies tightening from the economic crisis in Venezuela. Denial by rebels sabotaging Nigeria's crude exports that they had agreed to a month-long ceasefire was another supportive factor.

Brent crude futures' front-month, August <LCOQ6>, settled down 3 cents at $50.62 a barrel. In post-settlement, it rose to as high as $51.10, spurred by the crude draw reported by API.

U.S. crude futures' expiring July front-month contract <CLN6> closed down 52 cents, or 1 percent, at $48.85 a barrel. The August contract <CLQ6>, which will be front month from Wednesday, settled down 11 cents at $49.85 and rose to $50.40 in post-settlement.

Some market participants disputed the draw cited by API. The trade group's numbers, based on voluntary reporting by its members, have been at odds with market expectations and EIA data in the past.

"That's too big a draw if you ask me and we're not convinced by it," Matt Smith of New York-based crude cargo tracker Clipperdata said, referring to the API numbers.

"We think there will be a draw based on stronger refinery runs. But we also estimate that waterborne imports of crude alone rose by 5 million barrels last week, so we don't think the crude draw is going to be that large."

(Additional reporting by Libby George in LONDON; Editing by Marguerita Choy and David Gregorio)