The oil and gas sector of the economy in many states remains the main source of foreign exchange and tax revenues to the budget. Moreover, its share, for example, in Russia, accounts for about 12 % of all industrial production. However, this sector, as the practice of world oil prices shows, is experiencing not only a rise, but also a decline. Consequently, the problem of forming a balanced portfolio of oil and gas assets is an object of close attention on the part of national oil and gas companies. The issues of choosing the optimal combination of oil and gas assets in the portfolio are no less urgent, especially among the tasks that all oil and gas companies face, both in Russia and abroad. An investment portfolio or a portfolio of oil and gas assets, which includes new projects for the commissioning of fields, as well as measures to enhance oil recovery, and exploration are objects of real investment. The high volatility of the oil and gas industry is influenced by various factors, including: macroeconomic, innovation risks and a number of others. These circumstances stimulate the sector to increase the resilience of its project portfolios in order to respond flexibly to changes. In an increasingly challenging and uncertain environment, oil and gas companies around the world face constant pressures as difficult strategic decisions and building long-term plans lead to a sustainable portfolio. In order to achieve their goals and maximize profitability, companies should apply certain algorithms in their practice. The article substantiates the role and importance of project portfolio management in achieving the goals of the state and companies in the oil and gas sector. The main goal of the article is to build an algorithm that is aimed both at determining the stability of the portfolio and the ability to flexibly respond to changes in the environment. The scientific novelty of the research lies in the determination of an algorithm for assessing the sustainability of a portfolio of projects of oil and gas companies. Application of this algorithm will allow oil and gas companies to take into account the influence of external factors. The research methodology is based on such methods as analysis of internal regulations and reporting of companies for project portfolio management, risk analysis, project ranking; grouping and classification method.