From Comcast SportsNetBOSTON (AP) -- Jon Lester gave the New York Yankees ample opportunity to break open the game, and they failed nearly every time.The Yankees couldn't capitalize on Lester's career-high seven walks and fell into a first-place tie atop the AL East when Jacoby Ellsbury hit an RBI single in the bottom of the ninth inning that lifted the Boston Red Sox to a 4-3 victory Tuesday night."We had a ton of opportunities to score runs and we just didn't get the hits," Yankees manager Joe Girardi said.The loss and Baltimore's win over Tampa Bay left the Yankees and Orioles tied for the division lead with 79-62 records. New York hasn't won consecutive games since a three-game winning streak Aug. 13-15, allowing the Orioles and Rays, who are just two games back, to make it a tight race with three weeks to go."We need to string together some wins," said Derek Jeter, whose ground-rule double with two on in the sixth put New York up 3-2. "You wouldn't be tied for first unless you found ways to win games throughout the course of 140-something games that we've played. So we've got to do it again."Jeter's double put him on second with just one out, but Boston reliever Junichi Tazawa came in and got out of the jam by striking out Nick Swisher and Alex Rodriguez."They've got a job to do, too. We didn't get anything else after that," Jeter said. "You'd like to think that you'd be able to get something going, but they made some pitches when they needed to."It was one of many moments when the Yankees didn't come through and Dustin Pedroia made them pay in the bottom of the sixth with a solo home run to tie it back up at 3.Andrew Bailey (1-0) got the win after allowing one hit in one inning.David Robertson (1-7) retired his first four batters before giving up Pedro Ciriaco's single to left field with one out in the ninth. Mike Aviles then singled into the shortstop hole where Jeter fielded the ball but couldn't make the throw.Then Ellsbury capped an outstanding performance on his 29th birthday with a sharp single to right. Ciriaco came all the way around from second and slid in to beat the throw from right fielder Ichiro Suzuki to give Boston its second win in 13 games.The Red Sox wasted a chance in the seventh when they loaded the bases with one out and couldn't score. But they got outstanding work from their bullpen, which allowed just a hit and a walk with four strikeouts in 3 2-3 innings.The Yankees took a 3-2 lead in the top half on a two-run, ground-rule double by Jeter after a walk to Curtis Granderson, a single by Andruw Jones and a sacrifice by Jayson Nix.Lester had control trouble from the start, walking three in the first when the Yankees took a 1-0 lead. Jeter led off with a walk, took third on a double by Nick Swisher and scored on a groundout by Robinson Cano. Russell Martin and Steve Pearce also walked but were stranded.Lester walked the first two batters in the third and the leadoff hitter in the fourth but retired the next three batters in each inning. Then he struck out the side in the fifth, giving him 1,045 career strikeouts, the most by a Red Sox lefty. Bruce Hurst had the old mark of 1,044."He knows how to pitch. We had a lot of opportunities to score some more runs. We just didn't get it done," Jeter said. "Even though he had a lot of walks, he pitched out of it and that's what good pitchers do."The Red Sox took a 2-1 lead in the third on a double by Ciriaco and RBI singles by Ellsbury and Pedroia.Ciriaco went 2 for 3 and is 17 for 35 in nine career games against the Yankees, all this season with the Red Sox.NOTES:Lester's previous career high was five walks on nine different occasions, most recently on July 22 in a 15-7 loss to Toronto in which he allowed 11 runs. ... Yankees LHP Andy Pettitte is scheduled to throw in a simulated game Wednesday. He's trying to work his way back into the rotation after breaking his ankle June 28. Pettitte hopes to throw about 60 pitches. ... Injured 1B Mark Teixeira also was with the club even though he is sidelined for up to two weeks with a strained left calf, an injury he aggravated Saturday. "I think we can get plenty of work done here. There's really not that much I can do anyway. It's a lot of ice and a lot of ultrasound and stuff like that," Teixeira said. ... Swisher snapped an 0-for-28 slump with his double in the first. ... David Phelps (3-4) pitches for the Yankees against Aaron Cook (3-9) in the second game of the three-game series on Wednesday night. ... Yankees starter Hiroki Kuroda issued no walks and has just 14 in his last 15 starts.