Senate Democrats reached an agreement with Republican moderates to pare the huge bill after two days of tense negotiations.