Preheat oven to 400°F (200°C). Slice tops off garlic heads, drizzle with olive oil, wrap in foil, and roast for 30–35 minutes until soft.
In a large pot, bring broth to a gentle simmer with thyme and bay leaf.
Squeeze roasted garlic cloves into the pot and mash until blended into the broth. Remove thyme sprigs and bay leaf.
Optional: Whisk egg yolks in a bowl. Slowly add a ladle of hot broth while whisking, then stir mixture back into the soup for a silky texture.
Toast bread slices until golden. Rub lightly with raw garlic (optional).
Ladle soup into bowls, top with toasted bread, and sprinkle with Parmesan or Gruyère.