Heat the oven to 400°F (200°C).
Infuse the cream: In a medium pot, combine the cream, sage leaves, thyme sprigs, cloves, garlic, nutmeg, and a pinch of salt. Bring to a gentle simmer and cook until slightly reduced and fragrant, about 10 minutes. Strain through a fine sieve; discard the herbs and cloves.
Make the custard: In a large bowl, lightly whisk the eggs. Slowly pour in the warm cream, whisking constantly so the eggs don't scramble. Set aside.
Prep the dish: Generously butter the baking dish. Sprinkle about ¼ cup of the Graviera over the bottom.
First layer: Arrange a third of the sweet potatoes in the dish, slightly overlapping. Season with a pinch of salt and pepper. Pour over ⅓ of the custard, then sprinkle with ⅓ cup Graviera and ¼ cup prosciutto.
Second layer: Repeat with another third of the sweet potatoes, salt and pepper, ⅓ of the custard, ⅓ cup Graviera, and ¼ cup prosciutto.
Third layer: Top with the remaining sweet potatoes, salt and pepper, the remaining custard, ⅓ cup Graviera, and the remaining prosciutto.
Bake covered: Cover with a buttered sheet of foil and bake until the sweet potatoes are tender when pierced with a knife, about 40 minutes.
Bake uncovered: Remove the foil and sprinkle with the remaining Graviera (about ¼ cup). Bake until golden brown and bubbling and the center reaches 160°F (71°C), 25–30 minutes.
Rest: Let the gratin rest 10–15 minutes so the custard sets. Scatter with small sage leaves, if using, and serve.