Oil futures retreated slightly Tuesday but held near three-week highs on expectations that strong demand from U.S. refineries would continue to shrink domestic oil supplies.

Light, sweet crude for August delivery settled down 17 cents, or 0.2%, at $104.42 a barrel on the New York Mercantile Exchange. The August contract expired at settlement Tuesday. The more-actively traded September contract settled down 47 cents, or 0.5%, at $102.39 a barrel.

Brent crude on the ICE futures exchange fell 35 cents, or 0.3%, to $107.33 a barrel.

U.S. crude-oil supplies have fallen for three straight weeks as refineries have run at unusually high rates. U.S. refineries used 16.6 million barrels of oil a day in the week ended July 11, a record high in U.S. Energy Information Administration data going back to August 1982.

The EIA is due to release its data for the week ended July 18 on Wednesday. Analysts expect the agency to report that inventories fell by 2.5 million barrels, according to a Wall Street Journal survey.

Traders are particularly focused on supplies in Cushing, Okla., where the Nymex contract is priced. Inventories at Cushing have fallen sharply in recent months as new pipelines allowed more oil to be moved out of storage in Oklahoma to refineries along the Gulf Coast. Cushing supplies currently stand at the lowest level since 2008, which has sparked some concern that stocks may fall too low for oil to easily be pumped out of storage.

"The markets at long last are reflecting the tightness at Cushing," said Andy Lebow, senior vice president for energy at Jefferies Bache LLC. "It doesn't appear as if the tightness at Cushing is going to be alleviated anytime in the next few weeks."

At settlement, the August contract was $2.03 a barrel more expensive than the September contract. This is the largest premium that the front-month contract has had to the second month since 2008, indicating concerns that oil supplies are much scarcer in the near term than they will be in later months.

U.S. oil prices rose to a near-three-week high Monday but pulled back a bit Tuesday.

"This rally's probably starting to sputter," said Gene McGillian, broker and analyst at Tradition Energy in Stamford, Conn. He added that prices could rise again if refinery utilization rates stay as high as they were last week or increase.

Refinery use is seen falling 0.2 percentage point to 93.6% of capacity, according to the Wall Street Journal survey.

Gasoline supplies are expected to increase by 900,000 barrels, while stocks of distillates, including heating oil and diesel, are expected to rise by 1.9 million barrels.

The American Petroleum Institute, an industry group, said late Tuesday that its own data for the same week showed a 555,000-barrel decline in crude stocks, according to industry sources. The group also said that gasoline supplies rose by 3.6 million barrels, while distillate stocks grew by 2.5 million barrels, according to the sources.

Front-month August reformulated gasoline blendstock, or RBOB, settled down 1.07 cents, or 0.4%, at $2.8807 a gallon. August diesel settled down 0.46 cent, or 0.2%, at $2.8542 a gallon.