WASHINGTON—Congress Thursday cleared and sent to the White House a five-year, $305 billion highway bill that combines the demands of road builders and unions with the wishes of safety advocates and local transit planners.

The bill—which spans the longest time frame for a transportation measure in 17 years—would provide money for roads and rail projects, renew the Export-Import Bank, and even restore a crop-insurance subsidy.

Ferries...