"The two leaders expressed strong condemnation of the phenomenon of terrorism in all its forms," said an Indian foreign ministry statement after their talks.
They "agreed to enhance cooperation in counter-terrorism operations" and cyber-security, "including prevention of use of cyber space for terrorism, radicalisation and for disturbing social harmony," it added.
The two countries signed a memorandum of understanding on cooperation in intelligence-sharing on money laundry and terrorism financing, said a statement on the official Saudi Press Agency (SPA).
Just days ahead of Modi's two-day visit to Riyadh, Saudi Arabia and the US Treasury announced joint sanctions on four individuals and two organisations with alleged links to Al-Qaeda, the Taliban and Lashkar-e-Taiba (LeT) -- which India blames for the 2008 Mumbai attacks that killed 166 people.
Among those sanctioned was Saudi-based Muhammad Ijaz Safarash, who allegedly provided financial, material or technological support for the Pakistan-based militant group LeT.
"We affirm the importance of continued cooperation and coordination with your country's government in the field of fighting terrorism," King Salman told Modi, according to SPA.
Modi arrived in the world's largest crude exporter on Saturday and has held talks with top Saudi officials, his country's community in the Muslim kingdom, as well as Indian workers and local businessmen.
India, which imports around 80 percent of its oil needs, is keen to take advantage of low crude prices by signing overseas deals that will help secure supplies to meet its growing demand.
Indian foreign ministry official Shri Mridul Kumar has said ahead of the visit that almost 20 percent of the South Asian country's crude supplies come from Saudi Arabia and that New Delhi wants to ensure this supply continues.
The Indian foreign ministry statement on Sunday said that "the two leaders expressed satisfaction at their growing bilateral trade in the energy sector."
They agreed "to transform the buyer-seller relationship in the energy sector" to focus "on investment and joint ventures in petrochemical complexes, and cooperation in joint exploration in India, Saudi Arabia and in third countries," it added.
They also discussed regional and international developments, including the security situation in West Asia, the Middle East and South Asia, and agreed to bolster defence cooperation and diversify trade.
Their investment authorities meanwhile signed a framework agreement to facilitate investments by the private sectors in the two countries.
Saudi Arabia is home to 2.96 million Indian expatriates who send home over $10 billion in remittances every year, according to India's foreign ministry.