Memorandums of understanding were signed after Turkish President Recep Tayyip Erdogan held a closed meeting with the internationally-recognised government of Prime Minister Fayez al-Sarraj in Istanbul, the state-run Anadolu Agency reported quoting the Turkish Presidential Communications Directorate.
The move comes as Tripoli, the seat of the Government of National Accord (GNA), has been battling forces backed by renegade military commander Khalifa Haftar.
More than 1,000 people have been killed since April when Haftar's eastern-based, self-styled Libyan National Army (LNA) launched an offensive to seize Tripoli.
The interior, defence and foreign affairs of the two countries were also present and held talks during the visit.
Libyan Interior Minister Fathi Bashagha told local media that the memorandum of understanding on security signed between the two countries was aimed at maintaining security in Libya and protecting the country's sovereignty.
He added that the deal also sought to strengthen the government's capacity to combat "terrorism", irregular migration and crime, as well as developing its security and training systems.
The agreement called for an immediate cease of military operations near Libyan oil fields, in order to protect personnel and installations.
Oilfield shut after attack
The Chairman of the Libyan National Oil Corporation (NOC), Mustafa Sanallah, said on Wednesday that they shut down El Feel oilfield after a warplane bombed its gates and employees' residential compound.
He added that all the employees were transferred to safe places.
The Libyan official said that production will remain suspended until the cease of military operations and the withdrawal of all military personnel.
Libya has been split between the internationally-recognised government based in Tripoli and a rival government operating from the eastern city of Tobruk since the 2014 disputed elections.
International efforts to broker a deal have so far stalled as the parliament of the Tobruk government has blocked efforts to organise new elections because it wants a senior role for the renegade commander Haftar.