A series of well-planned and audacious attacks on police and government installations that left at least 40 people dead across Pakistan Thursday exposed major weaknesses in the nation's security apparatus and appeared to show Taliban insurgents gaining the upper hand.

During the course of the day, assailants in police uniform wielding guns and grenades struck at three security agency buildings in the eastern city of Lahore, leaving 28 dead. A suicide bomber in a car killed 11, including himself, at a police station in northwestern...