Megaryef placed a bouquet of flowers in front of the consulate where Stevens died on Tuesday when suspected Islamic militants fired on the compound with rocket-propelled grenades and set it ablaze.
Visibly moved, the president of the General National Congress said he regretted the loss of "a friend of Libyans who rendered laudable services to Libya."
Surrounded by heavy security, Megaryef was accompanied by Libya's military chief of staff Yussef al-Mangush.
Ambassador Stevens and three other Americans were killed by a mob outside the consulate in Benghazi on Tuesday as they tried to flee an angry protest against a US-produced movie deemed offensive to Islam.
US officials are investigating the possibility that the assault was an Al-Qaeda-linked plot using the protest a cover to carry out an attack on the anniversary of the September 11, 2001 attacks on the United States.