01 - Preheat oven to 375°F. Lightly grease a 9x13-inch baking dish with butter.
02 - Place potatoes in a large pot of salted water. Bring to a boil, then simmer until fork-tender, about 15–18 minutes. Drain well.
03 - While potatoes cook, heat olive oil in a large skillet over medium heat. Add sliced onions and sauté, stirring occasionally, until golden brown and caramelized, about 15–20 minutes. Add garlic and cook 1 minute more.
04 - Mash the drained potatoes with butter, warm milk, sour cream, salt, and pepper until smooth and creamy.
05 - Stir in half of the cheddar and mozzarella cheeses, then fold in the caramelized onions, reserving a few tablespoons for topping if desired.
06 - Spread the mashed potato mixture evenly in the prepared baking dish. Top with the remaining cheeses and reserved onions.
07 - Bake for 25 minutes, or until cheese is melted and bubbly with lightly golden spots.
08 - Garnish with fresh chives if desired. Serve hot.