NYPD Sgt. Paul Tuozzolo was remembered at his funeral Thursday as a “selfless, courageous” officer with a passion for policing and family.

By the thousands, police officers gathered outside St. Rose of Lima Church in Massapequa late Thursday morning to honor their fallen brother — nearly a week after he was fatally shot by a burglary suspect in the Bronx.

NYPD Commissioner James O’Neill posthumously promoted Tuozzolo to sergeant, special assignment.

“Sergeant Paul Tuozzolo was everything we could ever wish for in an officer: conscientious, hardworking, selfless, courageous, driven to protect,” O’Neill said in his eulogy. “Paul protected all New Yorkers, and he died while keeping people safe.”

O’Neill said that “between work and fatherhood, he was living out a dream.”

“And he took these two passions with him wherever he went,” O’Neill said. “On patrol, or while grabbing coffee at a nearby gas station, he talked all the time about Lisa and their two small boys, just three and four years old now.”

Mayor Bill de Blasio, on behalf of 8.5 million New Yorkers, extended deep gratitude and condolences to Tuozzolo’s family.

De Blasio called Tuozzolo a hero for not only protecting the public, but also for protecting his own officers by warning them that the suspect had a gun — and that saved one officer’s life.

“He could have sent his fellow officers forward, but he took the lead,” de Blasio said. “That is the measure of the man, and he gave his life protecting his fellow officers, protecting all of us.”

De Blasio added: “There is one fewer dangerous person on the streets today because Sgt. Tuozzolo stepped forward to fight danger, to fight crime, to fight the evil around us.”

After the funeral, under the clear, blue sky, the crowd stood silent as six pallbearers carried Tuozzolo’s coffin out of the church. Friends, families and dignitaries followed. 

Ten helicopters, in formation, then flew over the church. 

Tuozzolo’s interment will be at St. Charles & Resurrection Cemetery in East Farmingdale.

Earlier, during the funeral procession to the cavernous church, heavy security dotted Merrick Road, with snipers on rooftops and police dogs patrolling. 

Hundreds of NYPD officers as well as officers from Canada, Chicago and other departments across the metropolitan area converged outside the church ahead of the morning service. Police recruits from the NYPD and the Nassau and Suffolk police departments lined the funeral procession route, where the Putnam County, New York State, Park and MTA police were also represented. 

One group of officers had filed out of a blue bus with the slogan “Blue Lives Matter” in the window and then joined the crowd heading to the church. 

Six-year-old Kaitlyn, her brother and her nanny, Jenny Coccaro, were among those who lined up outside the church and waited for more than an hour for the funeral procession.

“I want to support the officers and let them know that we love them,” Kaitlyn said.

Tuozzolo, 41, of Greenlawn, died Nov. 4 shortly after the shooting, leaving behind his wife and two young children — the fifth line-of-duty death since December 2014 for the NYPD. 

Manuel Rosales, 35, of Brentwood, who police said shot Tuozzolo twice in the head with a gun stolen in Suffolk County years earlier, was subsequently killed in a hail of police gunfire. 

The NYPD said it expected 20,000 to 25,000 police officers to attend Tuozzolo’s funeral, with contingents coming from all over the country and Canada.

Tuozzolo, who grew up in Bayville, was a 19-year veteran of the NYPD, a department that has recently grappled with several line-of-duty killings: In October 2015, Officer Randolph Holder, 33, was killed along the FDR Drive in Manhattan while pursuing a shooting suspect. In May 2015, Officer Brian Moore, 25, of Massapequa, was fatally shot in the head in Queens. And in December 2014, Officers Rafael Ramos, 40, and Wenjian Liu, 32, were shot and killed in an ambush as they sat in their patrol car in Brooklyn.