WASHINGTON — The Senate gave final approval on Thursday to an ethics bill that bans insider trading by members of Congress, clearing the measure for President Obama, who called for such legislation in his State of the Union address two months ago.

The legislation was adopted by unanimous consent after the Senate voted, 96 to 3, to end debate on the bill, which was approved in the House last month by a vote of 417 to 2.

Senator Joseph I. Lieberman, independent of Connecticut and the chief sponsor of the measure, said it was “the most significant Congressional ethics legislation we’ve adopted in at least five years.”

The lopsided votes showed lawmakers desperate to regain public trust in an election year, when the public approval rating of Congress has sunk below 15 percent.