The deal will keep the talented attacker with the Reds until at least 2022.
Longstaff made his first-team debut in December when he led the line in the Carabao Cup quarter-final away at Aston Villa.
Since joining the club in 2015 from Newcastle United, the 19-year-old played mainly as a winger or central midfielder but has regularly taken the centre-forward position in the last 12 months.
A winner of the FA Youth Cup with the U18s in 2019, he stepped up to the U23s side and quickly scored his first goal in the 4-2 win at Southampton back in August.
He was also a member of the U19 UEFA Youth League squad, where his highlights included a brace in the 7-0 victory over Napoli in Kirkby.
Blessed with dangerous set-piece delivery, Longstaff has also been called up to train with the first team at Melwood on several occasions.