US and UK spy agencies built close ties with their Libyan counterparts during the so-called War on Terror, according to documents discovered at the office of Col Gaddafi's former spy chief.
The papers suggest the CIA abducted several suspected militants from 2002 to 2004 and handed them to Tripoli.
The UK's MI6 also apparently gave the Gaddafi regime details of dissidents.
The documents, found by Human Rights Watch workers, have not been seen by the BBC or independently verified.
Meanwhile, the head of Libya's interim governing body, the National Transitional Council, said its soldiers were laying siege to towns still held by Col Gaddafi's forces.
Mustafa Abdel Jalil said Sirte, Bani Walid, Jufra and Sabha were being given humanitarian aid, but had one week to surrender.
The BBC's Jon Leyne in Benghazi says there have been unconfirmed reports that Bani Walid has now been taken by anti-Gaddafi forces.
But witnesses on the edge of Bani Walid say the opposition fighters are still on the outskirts although our correspondent adds that it appears as if Gaddafi loyalists have abandoned many of their outlying positions.
Thousands of pieces of correspondence from US and UK officials were uncovered by reporters and activists in an office apparently used by Moussa Koussa, who served for years as Col Gaddafi's spy chief before becoming foreign minister.
He defected in the early part of the rebellion, flying to the UK and then on to Qatar.
Rights groups have long accused him of involvement in atrocities, and had called on the UK to arrest him at the time.
The BBC's Kevin Connolly in Tripoli says the documents illuminate a short period when the Libyan intelligence agency was a trusted and valued ally of both MI6 and the CIA, with the tone of exchanges between agents breezy and bordering on the chummy.
Human Rights Watch accused the CIA of condoning torture.
"It wasn't just abducting suspected Islamic militants and handing them over to the Libyan intelligence. The CIA also sent the questions they wanted Libyan intelligence to ask and, from the files, it's very clear they were present in some of the interrogations themselves," said Peter Bouckaert of HRW.
The papers outline the rendition of several suspects, including one that Human Rights Watch has identified as Abdel Hakim Belhaj, known in the documents as Abdullah al-Sadiq, who is now the military commander of the anti-Gaddafi forces in Tripoli.
The Americans snatched him in South East Asia before flying him to Tripoli in 2004, the documents claim.
Mr Belhaj, who was involved in an Islamist group attempting to overthrow Col Gaddafi in the early 2000s, had told the Associated Press news agency earlier this week that he had been rendered by the Americans, but held no grudge.
The CIA would not comment on the specifics of the allegations.
Spokeswoman Jennifer Youngblood said: "It can't come as a surprise that the Central Intelligence Agency works with foreign governments to help protect our country from terrorism and other deadly threats."
The documents also reveal details about the UK's relationship with the Gaddafi regime.
One memo, dated 18 March 2004 and with the address "London SE1", congratulates Libya on the arrival of Mr Belhaj.
It states "for the urgent personal attention of Musa Kusa" and is headed "following message to Musa in Tripoli from Mark in London", according to the Financial Times. Its authenticity could not be independently verified.
The UK intelligence agency apparently helped to write a speech for Col Gaddafi in 2004, when the government of Prime Minister Tony Blair was encouraging the colonel to give up his weapons programme.
And British officials also insisted that Mr Blair's famous 2004 meeting with Col Gaddafi should be in his Bedouin tent, according to the UK's Independent newspaper, whose journalists also discovered the documents.
"[The prime minister's office is] keen that the prime minister meet the leader in his tent," the paper quotes a memo from an MI6 agent as saying.
"I don't know why the English are fascinated by tents. The plain fact is the journalists would love it."
In another memo, also seen by the Independent, UK intelligence appeared to give Tripoli details of a Libyan dissident who had been freed from jail in Britain.
UK Foreign Secretary William Hague played down the revelations, telling Sky News that they "relate to a period under the previous government so I have no knowledge of those, of what was happening behind the scenes at that time".
Mr Blair and US President George W Bush lobbied hard to bring Col Gaddafi out of international isolation in the years after the 9/11 attacks, as Libya moved to normalise relations with former enemies in the West.
In a press conference in Benghazi, Mr Jalil said four Gaddafi-held towns had one week to surrender "to avoid further bloodshed".
But our correspondent, Jon Leyne, says there are reports Bani Walid has now fallen without a fight, with Gaddafi loyalists either melting away or regrouping further south. However, these reports have not been confirmed.
One anti-Gaddafi commander, Abdulrazzak Naduri, had earlier told AFP that Bani Walid had until just 08:00 on Sunday or face military action.
Col Gaddafi's whereabouts remain unconfirmed. It was believed that two sons, Saadi and Saif al-Islam, had been in Bani Walid recently.
The NTC is stepping up its efforts at reconstruction, setting up a supreme security council to protect Tripoli.
Ian Martin, a special adviser to the UN secretary general, arrived in Libya's capital on Saturday to try to boost international efforts in the country's redevelopment.
The NTC has also said its leadership will not now move from Benghazi to Tripoli until next week, with Mr Jalil the last to go.
Our correspondent says this could mean a delay in the opposition formally assuming the role of the new government and raise fears of a power vacuum in the capital.