Detroit hasn't beat the Knicks since Nov. 6, 2019, the end of its eight-game winning streak over New York.
New York led by seven at halftime and increased the margin to 90-80 on Randle's buzzer-beating tip at the end of the third.
The Knicks started the fourth with a 10-2 run, including five from Quickley to go up 100-82 with 9:43 left.
Detroit cut the deficit to 105-98 on Isaiah Livers' 3-pointer, but the game was delayed for several minutes by a malfunctioning shot clock. Randle's 3-pointer put the margin back to double figures, and he answered Bey's basket with one of his own.
Randle helped the Knicks clinch the game from the line.
The Knicks led by as many as 20 in the first half, taking advantage of Isaiah Stewart's foul trouble, but Bey and Kevin Knox II helped Detroit cut the deficit to 62-55 at halftime.
Knicks: New York had 11 offensive rebounds to Detroit's four in the first half. ... Quickley scored 17 of New York's 20 bench points. ... The Knicks swept the four-game season series by an average of 19 points.
Pistons: Detroit got Stewart back from a shoulder issue but played without starters Jalen Duren (ankle) and Bojan Bogdanovic (non-COVID illness), along with long-term absentees Cade Cunningham (leg fracture) and Marvin Bagley III (broken hand).
Knicks: Host the Toronto Raptors on Monday.
Pistons: Host the Chicago Bulls on Thursday.
More AP NBA: https://apnews.com/hub/NBA and https://twitter.com/AP_Sports
Dave Hogg, The Associated Press