PHOENIX (AP) Coming off four losses on a six-game trip to the East, the Phoenix Suns felt sluggish early in Wednesday night's game.

They found new energy in the second half and were able to fend off the Orlando Magic in the closing minutes.

Brandon Knight scored 17 of his 21 points after halftime, Alex Len set a career high with 20 points and tied a career best with 14 rebounds, and the Suns beat the Magic 107-104.

More from FoxSports

''We just have to continue to stick together,'' Knight said. ''We believe in ourselves. We put the time in and we put the work in.''

Eric Bledsoe made a tiebreaking layup for Phoenix with 1:11 left and finished with 21 points and nine assists. The Magic had a couple of chances to tie in the final 30 seconds but turned the ball over, and Victor Oladipo and Evan Fournier missed potential game-tying 3-pointers in the final five seconds.

''We definitely needed this win. We came off a tough stretch,'' Bledsoe said.

Bledsoe made one of two free throws with 17 seconds left for the final margin.

''It's a good win for them because they stuck with it, they gutted it out,'' Suns coach Jeff Hornacek said of his players.

Nikola Vucevic led Orlando with 21 points and 11 rebounds, but missed a short follow shot in the final minute that could have tied it.

The Magic's Elfrid Payton turned the ball over on an over-and-back violation with 27 seconds left.

''I was dribbling and I don't know. I kind of lost it. Nobody touched it. I just lost it,'' said Payton, who finished with 12 points and 10 assists.

The Suns trailed for much of the first half, but rallied in the third quarter. Knight and Bledsoe combined for 22 of the Suns' 35 points in the period.

Len had 11 points in the third, and Phoenix carried an 84-73 lead into the fourth. But the Magic responded with a 13-2 run, and Vucevic's jumper with 9:20 left tied it at 86.

''I have to give credit to my teammates. They were looking for me the whole night,'' Len said.

The Suns led by 11 twice and 10 once in the fourth, only to see the Magic come back. But Phoenix improved to 7-0 against teams playing on the second night of back-to-back games this season.

''Their guards destroyed us. It was that simple,'' Magic coach Scott Skiles said. ''They penetrated really well. We tried to switch coverage a couple of times. Tried to mix it up but we couldn't handle it.''

This was the Suns' seventh straight game with a final margin of five points or fewer, the first time that has happened in franchise history, according to the Elias Sports Bureau.

Orlando took a nine-point lead in the second quarter on Shabazz Napier's 3-pointer. The Suns tied it at 39 on a 3 from Mirza Teletovic with 4:54 to play in the half. P.J. Tucker tipped in a missed shot at the halftime buzzer for a 49-47 Suns lead.

TIP-INS

Magic: F Aaron Gordon returned after missing Wednesday's game with a sprained right ankle and played 12 minutes. ... F Tobias Harris was accidentally poked in the eye by Tucker early in the third quarter and left the game, but returned to action later. Harris finished with 16 points. ... Former Sun Channing Frye, a popular player in his time in Phoenix in part because of his local roots, started for the Magic. Frye got a cheer from the crowd when he was introduced.

Suns: F Markieff Morris (sinus infection) and C Tyson Chandler (right hamstring strain) did not play. Chandler's absence allowed for more minutes for Len. ... The Suns sang happy birthday to Bledsoe earlier in the day and gave him a cake. He turned 26.

KNIGHT FLYER

Knight made only two shots in the first half, but one was a high-flying dunk midway through the second quarter. Off a steal, Knight passed ahead to Bledsoe on the break, and he fed the hustling Knight in the paint. Knight elevated above the hoop for a one-handed jam.

UP NEXT

Magic: Host Cleveland on Friday night.

Suns: Host Portland on Friday night