Mr Xi was seen off at King Khalid International Airport by Prince Faisal bin Bandar bin Abdulaziz, Governor of Riyadh, and Prince Faisal bin Farhan, the kingdom’s Minister of Foreign Affairs.
The Chinese president arrived in the kingdom on Wednesday and was given a lavish welcome that was broadcast on Saudi television, with his plane receiving an escort from four Royal Saudi Air Force jets, before being accompanied by six aerobatic jets that created green smoke trails.
After signing a number of agreements with Saudi Arabia on the first two days of his visit, Mr Xi attended GCC-China and Arab-China summits in Riyadh on Friday.
The GCC states and China agreed on a four-year joint plan of action to enhance their strategic partnership, according to a statement released on Friday.
The participants agreed to strengthen co-operation on economic recovery after the Covid-19 pandemic and "ensure flexibility on supply chains, food security and green energy", as well in the space and health sectors.
Mr Xi announced the setting up of China-GCC investment council.
The summits also expressed support for the one-China policy.
“Sino-Gulf relations are based on mutual trust,” Mr Xi noted.
“We must strengthen co-operation and trust, support multi-polarity, and not interfere in others' affairs. Our relations reflect support for multi-polarity and joint co-operation.”
Participants also called for Iran's "full co-operation" with the UN nuclear watchdog "to ensure the peaceful nature of the Iranian nuclear programme".
At the Arab-China summit, the participants agreed to co-operate in eight broad sectors, including energy, security, healthcare, technology and humanitarian assistance.
China's Foreign Ministry said the gathering was the “largest and highest-level diplomatic event between China and the Arab world since the founding of the People’s Republic of China”.
Mr Xi's visit to Saudi Arabia was only his third overseas trip since the outbreak of Covid-19 in late 2019.
The pandemic has heavily affected China's international trade due to strict entry requirements.
The agreements covered judicial assistance, direct investments, education and hydrogen energy, Saudi state media reported.
The kingdom signed a memorandum with China's Huawei Technologies on cloud computing and building high-tech complexes in Saudi cities. Huawei has participated in building 5G networks in most Gulf states.
China is the largest trading partner for Arab states, with trade surging from $239.8 billion in 2020 to $330.3 billion in 2021. Their trade this year is estimated to be $319.3 billion, according to figures from the China-Arab States Co-operation Forum, Chinese National Bureau of Statistics, the Chinese General Administration of Customs and China's Ministry of Commerce.