Oil prices rose slightly on Friday but remained on track for a third straight week of declines due to weak demand in China, the world's largest crude importer, and expectations of a ceasefire deal for the Gaza war and related violence in the Middle East.

Brent crude futures for September rose 15 cents, or 0.2%, to $82.52 a barrel by 0648 GMT. U.S. West Texas Intermediate crude for September increased 13 cents, also 0.2%, to $78.41 per barrel.

The gains on Friday and Thursday, which were mainly due to data showing the U.S. economy had grown at a faster-than-expected rate during the second quarter, were dwarfed by broader declines in recent weeks.

The benchmarks have fallen about 5% in the last three weeks. Brent is trading marginally lower this week, while WTI is down more than 2%.

Chinese data this week showed the country's apparent oil demand fell 8.1% to 13.66 million barrels per day in June, prompting concerns about consumption, according to ANZ Research analysts.

"The weakness is likely driven by gasoline and diesel, as rising new energy and autonomous driving vehicles become more popular," ANZ said.

Also dragging prices were brighter hopes of an end to the war in Gaza.

U.S. Vice President Kamala Harris pressured Israeli Prime Minister Benjamin Netanyahu on Thursday to help reach a ceasefire deal that would ease the suffering of Palestinian civilians, striking a tougher tone than President Joe Biden.

A ceasefire has been the subject of negotiations for months. U.S. officials believe the parties are closer than ever to an agreement for a six-week ceasefire in exchange for the release by Hamas of women, sick, elderly and wounded hostages.

(Reporting by Laila Kearney in New York and Sudarshan Varadhan in Singapore; Editing by Jamie Freed and Miral Fahmy)