"The members of the Security Council stressed the need for all parties to urgently de-escalate the situation and to commit to a ceasefire," the 15-member body said in a joint statement on Friday.
"Lasting peace and stability in Libya will come only through a political solution."
The UN's most powerful body also called on the parties to rapidly return to UN-mediated political talks, and urged other countries not to intervene or exacerbate conflict in Libya, which has been wracked by chaos since the NATO-backed overthrow of leader Muammar Gaddafi in 2011.
The council press statement was the first approved by all 15 members since the leader of the self-styled Libyan National Army, Khalifa Haftar, launched an offensive in early April to wrestle the capital from forces loyal to the UN-recognised Government of National Accord (GNA).
The statement was spurred by Tuesday night's raid on the detention centre in Tajoura, which the council said killed 53 people and wounded more than 130 others. The International Organization for Migration said on Friday that six children were among those killed.
The UN body met on Wednesday, but was unable to issue a statement - which needs consensus - because the United States could not agree to it, diplomats said.
However, the statement issued on Friday was largely unchanged from the language discussed on Wednesday, diplomats said.
The council has struggled to unify on how to deal with the renewed violence in Libya. Shortly after Haftar began his offensive, the US and Russia both told council colleagues that they could not support a resolution that would have called for a ceasefire in Libya.
The renewed conflict threatens to disrupt oil supplies, spur migration across the Mediterranean to Europe, scupper UN plans for an election to resolve the rivalry between the parallel administrations in east and west - and create a security void that armed groups could fill.
The warring parties both enjoy military support from regional powers.
Haftar's forces have been supplied for years by the United Arab Emirates and Egypt, while Turkey recently shipped arms to Tripoli to stop Haftar's assault, diplomats said.
"The members of the Security Council called for full respect for the arms embargo by all member states," the statement read, and "called on all member states not to intervene in the conflict or take measures that exacerbate the conflict."
The council also "expressed deep concern" over the worsening humanitarian situation in Libya, and called on the parties to allow full access for humanitarian agencies. It also said it was "concerned about the conditions in the detention centers which are the responsibility of the Libyan Government."
Some 6,000 are held in government-run detention centres in what human rights groups and the UN say are often inhumane conditions.
In April, US President Donald Trump praised Haftar amid his military assault on Tripoli.
In a phone call to Haftar, Trump "recognised Field Marshal Haftar's significant role in fighting terrorism and securing Libya's oil resources, and the two discussed a shared vision for Libya's transition to a stable, democratic political system," a White House statement said.
Trump's praise for Haftar was seen in Tripoli as a reversal in US policy on Libya, as Secretary of State Mike Pompeo demanded an immediate halt to Haftar's offensive earlier that month.
Our IP Address: