The Senate passed a sweeping new ethics bill on Thursday that would ban insider trading by members of Congress and require prompt disclosure of stock transactions by lawmakers and by thousands of officials in the executive branch of government.

The 96-to-3 vote followed three days of impassioned debate in which senators tried to outdo one another in proclaiming their support for ethics in government.

President Obama called for passage of such legislation in his State of the Union address last week. More than half of House members, including at least 100 Republicans, have signaled support for it, and House Republican leaders said Thursday that they would schedule consideration of the Senate-passed bill on the House floor next week.

A handful of lawmakers have tried for years to enact restrictions on stock dealing by members of Congress. Their efforts drew little support until new attention to the practice last year — coupled with election anxiety — prompted a flood of backing for the idea and support from Mr. Obama.

Senators of both parties said the bill was desperately needed to restore trust in Congress at a time when its public approval rating had sunk below 15 percent.

Senator Kirsten E. Gillibrand, Democrat of New York and an architect of the bill, said its purpose was simple: “to make sure that members of Congress play by the exact same rules as everyone else.”