* YPFB seeks financing and partnerships to boost oil and gas production

* Bolivia pivots to cheaper oil purchases from OPEC producers via Botrading S.A.

* Russia aiding Bolivia with fuel supply issues amid domestic production decline

LA PAZ, July 4 (Reuters) - Bolivian state energy firm YPFB is looking to improve conditions for investment in the country's flagging oil and gas sector and seeking help from Russia to overcome recent fuel shortages, the head of the company told Reuters.

The landlocked South American nation is reeling from a foiled military coup against the government last week, which stemmed in part from a rising economic crisis linked to years of declining oil and gas production that have hit hard-currency reserves.

In an interview in Bolivia just days after the failed June 26 coup attempt, YPFB President Armin Dorgathen conceded that political missteps in recent years had put off investors, harming output. Gas production has halved from a peak a decade ago, while oil output is its lowest since the 1990s.

"We are working to attract financing from various sides and also looking for partners," Dorgathen told Reuters earlier this week. He cited issues with payments, legislation and regulation under the country's largely socialist leadership in recent years that made it tough for private firms - a situation that YPFB was now trying to change.

"The sector was discouraged," he said. "We are now working also with the partners we already have here in Bolivia - Repsol , TotalEnergies, Petrobras, so that additional investments can be made."

The slide in domestic oil and gas output has been at the heart of Bolivia's recent economic and political woes. Once an important gas exporter to neighbors like Brazil, the production drop has hammered export revenue and left central-bank reserves almost depleted.

Protests linked to the lack of dollars and long queues at gas stations have become increasingly common, stoking tensions and leading to in-fighting in the ruling socialist MAS party between President Luis Arce and former leader Evo Morales.

Arce headed off an apparent coup attempt last week when a rogue general led units of armed soldiers to seize the central square in political capital La Paz, including ramming the door of the presidential palace with an armored vehicle. The general cited a deteriorating economy as partly behind his rebellion.

Dorgathen said in the short-term the biggest energy issue was a gasoline shortage, which has put a spotlight on costly imports. Bolivia imports half of the gasoline needed to meet domestic demand, costing some $800 million annually.

He told Reuters the country was pivoting toward more direct - and lower-cost - purchases from producers in the Organization of the Petroleum Exporting Countries and others via its new Botrading S.A. state energy trading firm.

"Our objective through OPEC is to access cheaper fuel and improve supplies," Dorgathen said. The government was also seeking help from Russia, which is part of the so-called OPEC+ coalition, to ease fuel supplies. Russia has been hit by sanctions on energy exports due to its 2022 invasion of Ukraine. Russia's Lukoil delivered 366,000 barrels of diesel on June 19 for YPFB from the Baltic Sea port of Vysotsk.

Dorgathen attributed the sharp decline in gas production to a lack of investment in exploration but said that income from exports was "being maintained" and disputed that there was any issue with domestic gas supplies. He reiterated hopes for the announcement of a major new find later this year.

"There is no internal supply problem," said Dorgathen. "We still produce almost three times more gas than we consume."

(Reporting by Lucinda Elliott and Daniel Ramos in La Paz Editing by Matthew Lewis)