1 1/2 sticks (12 tablespoons) unsalted butter, at room temperature, plus more for greasing the pans
2 1/2 cups all-purpose flour
1 teaspoon baking powder
3/4 teaspoon fine salt
1/2 teaspoon baking soda
1 cup packed light brown sugar
2/3 cup smooth peanut butter
1/2 cup granulated sugar
4 large eggs
1 teaspoon pure vanilla extract
1 cup milk
Frosting and Filling:
1/2 cup unsweetened coconut flakes
4 ounces semisweet chocolate, chopped
4 tablespoons unsalted butter
1 cup unsweetened cocoa powder
2 teaspoons pure vanilla extract
1/4 teaspoon fine salt
3 cups confectioners’ sugar
2/3 cup milk
1/2 cup smooth peanut butter
3/4 cup heavy cream
Special equipment: two 9-inch round cake pans
For the cake: Position an oven rack in the center of the oven, and preheat to 350 degrees F. Butter two 9-inch round cake pans, and line the bottom of each with a round piece of parchment. Sift together the flour, baking powder, salt and baking soda onto a piece of parchment or into a large bowl.
Beat the butter, brown sugar, peanut butter and granulated sugar in a large bowl with an electric mixer on medium-high speed until the mixture is light and creamy, about 5 minutes. Scrape down the side of the bowl as needed. Add the eggs, 1 at a time, beating well after each addition. Continue beating until the mixture is light and creamy, about 2 minutes. Beat in the vanilla. Reduce the mixer speed to medium-low, and add the flour mixture in 3 additions and the milk in 2 additions, beginning and ending with the flour. Beat until just combined.
Divide the batter evenly between the prepared cake pans. Bake until a toothpick inserted in the center comes out clean, 30 to 35 minutes. Let the cakes cool in the pans for a few minutes, then transfer them to a cooling rack to cool completely. Invert each onto a cooling rack, and remove the parchment. (The cakes can be stored at room temperature, wrapped in plastic wrap, for 1 day.)
For the filling: Spread the coconut out on a baking sheet, and bake at 350 degrees F until golden and toasted, about 8 minutes.
Put the chocolate and butter in a medium bowl, microwave for 1 minute, stir until smooth and pour into a large bowl. Add the cocoa powder, vanilla and salt, and mix with an electric mixer on low speed until combined. Continue to mix on low speed, adding the sugar a cup at a time and alternating with additions of the milk. Increase the mixer speed to medium-high, and mix until smooth. (If not being used immediately, the filling can be refrigerated in an airtight container for up to 3 days; let it come to room temperature and mix on medium-high until smooth.)
To assemble: Slice each cake in half, for a total of 4 rounds. Spread the peanut butter on 3 of the rounds, dividing evenly. Sprinkle 2 tablespoons of toasted coconut on each of the 3 rounds. Put 1 round, peanut butter-and-coconut-side up, on a cake stand or serving platter, and spread about 1/2 cup of the chocolate filling on top, leaving about a 1/2-inch border all around. Repeat with 2 more layers of cake and filling. Place the last cake round (without the peanut butter and coconut) on top.
For the frosting: Put the remaining 1 1/2 cups of the filling in a large bowl, add the cream and beat with an electric mixer on medium-high speed until medium peaks form. Frost the cake and sprinkle the top with the remaining toasted coconut. Refrigerate the cake until it sets up (this makes it possible to cut neat slices), at least 4 hours up to overnight. Serve chilled or at room temperature.