In a large nonstick skillet, bring 1 cup water to a boil. Add the spinach, 1 bag at a time, and stir until wilted, about 3 minutes; drain. Rinse with cold water, squeeze out as much liquid as possible, then coarsely chop. Rinse the skillet.
Preheat the oven to 400 degrees . In the skillet, heat the olive oil over medium-high heat. Add the onion and cook, stirring occasionally, until softened, about 8 minutes. Stir in the garlic, 3/4 teaspoon salt and 1/2 teaspoon pepper; cook for 2 minutes.
Stir in the cream cheese, mashing until smooth. Stir in the spinach, artichokes, mayonnaise and two-thirds of the gruyere. Transfer to a shallow baking dish.
Finely chop 4 of the toasted pita triangles. In a small bowl, combine the chopped pita with the remaining gruyere and sprinkle over the spinach-artichoke mixture; bake until golden-brown and bubbling, 15 to 20 minutes. Serve warm with the remaining toasted pita triangles.