Heat a cast-iron skillet over medium heat. Butter one side of each slice of bread. On two slices, spread the pesto on the unbuttered side.
Place those two slices, buttered side down, in the hot skillet. Spread half the cheese evenly over the two slices. Divide the tomatoes evenly in a single layer between the two slices. If using fresh basil, sprinkle evenly over the tomatoes. Divide remaining cheese evenly between the two slices and top with remaining bread, buttered side up.
Press lightly with a spatula, cover and good 5 minutes on low until golden brown. Carefully turn sandwiches over and cook, uncovered, another 5 minutes until golden brown and cheese is melted.