Perez fired the Foxes ahead on 29 minutes after a pass by 19-year-old left-back Luke Thomas, who impressed on his senior debut.
Jamie Vardy hit a post and Harvey Barnes twice went close to a second for Leicester after half-time.
Substitute Gray doubled their lead in the 79th minute when he shot low into the far corner after being set up by Vardy.
Sheffield United’s best chance to respond came when John Egan’s deflected header was turned away by Kasper Schmeichel.
Sheff Utd stay eighth on 54.
Leicester: 19 Jul v Spurs (A)
Sheff Utd: 20 Jul v Everton (H)