Knowing he was facing Cliff Lee, who was coming off a three-hit shutout against the Marlins a week ago, Ryan Dempster knew his margin for error was thin.

“You can’t make mistakes,” he said.

Having given up 20 hits and 15 runs over his past three starts, Dempster was staggering into an obvious pitchers' duel. But for most of the Red Sox 3-1 loss to the Philadelphia Phillies Tuesday night at Fenway Park, he went round-for-round with Lee, coming closer to finding the fastball command that had recently eluded him while using his secondary pitches to keep the Phillies off-balance.

He threw seven solid innings, giving up just six hits and striking out four. He fanned Ryan Howard with his splitter and slider for two of his four Ks. Those became his out pitches as the game progressed.

“I feel better,” Dempster said. “Threw the ball a little bit better tonight, but just got out-pitched by the other guy. Cliff Lee's tough. When you're going to go out there and match up against him, you can't make many mistakes. I made a couple tonight, it cost us a couple runs, and he did a good job pitching against us.

Dempster gave up a first-inning home run to Mike Young, who had been in an 0-for-21 slump prior to hitting his second homer of the season. But for the next five innings, Dempster didn’t allow a runner past second, pitching to contact and working around the three walks he issued.

“I thought Ryan Dempster was much improved over his previous three starts,” said Red Sox manager John Farrell. “Much like we saw prior to that three-start stretch where he was down in the strike zone, he had good secondary stuff. But we ran into a very good pitcher tonight. Cliff Lee was outstanding.”

Still, Dempster (2-6) had to swallow another tough loss. Farrell's takeaway, though, was that against an aggressive lineup, Dempster was able to work his way out of some recent struggles.

"He was able to go to good location early in the count with his fastball," Farrell said. "Saw a lot of early outs with his split and his slider both. But it was very encouraging to see. Despite the outcome here tonight, his seven solid innings of work was needed and good to see him do that."