Both.
The Republicans were grossly outnumbered in both houses in 1964.
Please use the link I gave you, and take a look at the actual vote.
The Democrats didn’t vote in large enough numbers to win in either body. And you have pointed out a very good point. They easily could have.
It took Republicans to enable the bills.