Preheat oven to 350 degrees. Cut a piece of aluminum foil about 12-by-8-inch inches and line with parchment paper.
Slice off the top quarter of each head of garlic and place cut side up on parchment paper-lined foil; drizzle with olive oil and sprinkle with salt and pepper. Fold foil and seal to enclose. Transfer foil-wrapped garlic to a baking sheet; transfer to oven and roast until garlic is golden brown, about 1 hour.
Remove from oven and let foil-wrapped garlic stand until cool enough to handle. Squeeze each head of garlic, gently pressing with your fingers to expel cloves into a small bowl; stir garlic with a rubber spatula to blend thoroughly. Store in an airtight container, refrigerated, up to 2 weeks.