Modi had arrived in China on Thursday for the unprecedented informal summit with Xi.
The prime minister held one-on-one talks with Xi which is being seen as an effort by India and China to rebuild trust and improve ties that were hit by the 73-day-long Dokalam standoff last year.
The two leaders exchanged views on "solidifying" the India-China relationship and decided to issue strategic guidance to their respective militaries to strengthen communications and to build trust and understanding.
They recognised terrorism as common threat and committed to cooperate further on counter terrorism.
Modi also offered to host the next informal summit with Xi in India next year, a proposal which elicited a positive response from the Chinese president.
The two leaders began their informal meetings way back in 2014 when Xi was hosted by Modi at the Sabarmati Ashram of Mahatma Gandhi in Gujarat. They have met and interacted with each other in about a dozen international meetings since then.
This is the fourth visit of Modi to China after he came to power in 2014. He is again due to visit China to take part in the SCO summit to be held at Qingdao city on June 9-10.
Modi was seen off by Chinese Vice Foreign Minster, Kong Xuanyou and Chinese Ambassador to India, Luo Zhaohui and other officials.