The rescue took place on Friday, with 158 men, 33 women and 14 children taken from three inflatable boats off the coast of Zawiyah, 45 kilometres west of the capital, a navy statement said.
After receiving calls for help, coast guards had found the boats between 45 and 50 nautical miles (83-93 kilometres) offshore, it said.
The migrants, who came from African nations including Mali, Ivory Coast and Guinea, were returned to port in east Tripoli.
Rescued migrants returned to Libya are often detained in overcrowded detention centres, where a lack of regulation means people face torture, sexual abuse and forced labour.
Their situation deteriorated after fighting broke out south of Tripoli in April, with forces loyal to eastern-based strongman Khalifa Haftar attempting to seize the capital from Libya's unity government.
The battle has killed more than 1,000 people and displaced 120,000, according to the United Nations.
Some 40,000 refugees and asylum-seekers also live outside detention centres in urban areas in Libya, according to the United Nations agency for refugees (UNHCR).
The chaos that followed the fall of dictator Moamer Kadhafi in 2011 enhanced Libya's status as a transit route to Europe for migrants coming from the Sahel, east Africa and the Middle East.
bur-rb/cm/par