BOSTON — David Ortiz reached 20 homers for the 15th consecutive season and drove in three runs, Steven Wright pitched efficiently into the seventh inning and the Boston Red Sox beat the sloppy Texas Rangers 11-6 on Wednesday night.

Bryce Brentz drove in three runs with two singles and Ryan Hanigan had a two-run single for the Red Sox, who took two of three from the AL West-leading Rangers.

Prince Fielder hit a two-run homer for Texas, which has lost six of eight and finished a 10-game, three-city trip at 5-5.

Wright (10-5) gave up six runs — five earned — and was pulled after Ian Desmond’s two-run triple with no outs in the seventh. The 31-year-old knuckleballer was voted an All-Star for the first time in his career.

Texas starter Martin Perez (7-5) was tagged for 11 runs — seven earned — in four innings.

Ortiz made it 2-0 in the first with his 523rd homer, a drive over the bullpens in right. He’s hit over 20 homers in each of his 14 seasons with Boston after exactly 20 his final year with Minnesota in 2002. The 40-year-old slugger has said he’s retiring after this seaosn.

The Red Sox opened an 11-1 lead by scoring five runs in the second, two in the third and two more in the fourth.

advertisement | advertise on newsday

In the second, they scored all the runs on two hits, capitalizing on three errors for four unearned runs. Hanigan had a bases-loaded, two-run single, Mookie Betts an RBI double and Ortiz a sacrifice fly.

In the third, Brentz had an RBI single and he added a two-run single the next inning.