More cops, more bomb-sniffing dogs and more police snipers than ever are being deployed by the NYPD for New Year’s Eve to protect the 2 million spectators expected to cram Times Square to usher in 2018, department leaders said Thursday.

NYPD Commissioner James O’Neill said counterterrorism planners are heeding lessons from recent terrorist attacks, including three in Manhattan since September 2016.

“People will be safe,” O’Neill said, “and they should feel safe, too.”

At 11 a.m. Sunday, crosstown traffic was shut down from 37th to 59th streets and Sixth to Eighth avenues, and the area was sealed off with concrete barriers, blocker cars and sand-filled trucks, said Terence Monahan, the NYPD’s patrol chief.

He said the department is also restricting trucks on those avenues from 34th to 59th streets.

To stop a suicide bomber from detonating an explosive like the one set off Dec. 11 under the Port Authority bus terminal, officers are searching celebrants twice — when a person approaches the Times Square area, and again at each designated gathering place — with specially trained dogs and metal detectors, and by officers examining each reveler’s bags.

To avert a Las Vegas-style sniper shooting from above, NYPD officers are being assigned to every hotel in the Times Square area. O’Neill hinted that guest rosters are being scrutinized, but he declined to elaborate.

The NYPD is focusing on about 20 hotels and office buildings, especially about a dozen with a direct line of sight to the crowd below, said Steve Davis, the NYPD’s chief spokesman.

To block a vehicle-ramming attack like the rented pickup on Halloween that killed pedestrians on a bike path near the West Side Highway, sand-filled garbage trucks are parked at intersections near Times Square, with all 125 area garages ordered closed and sealed to protect from an exploding vehicle being left inside.

James Waters, the NYPD’s counterterrorism chief, said analysts are also monitoring online propaganda put out by groups like the Islamic State, and issuing bulletins to officers on how to identify and kill, as a last resort, would-be suicide bombers and take cover to protect themselves and the public.