Preheat the oven to 400°F (200°C).
Slice the tofu into 1/2-inch (1.2 cm)–thick pieces. Wrap the tofu with paper towels and microwave for 2 minutes to remove excess moisture. Wipe gently to remove as much liquid as possible, then set aside.
Finely chop the onion and garlic. Heat the oil in a pan over medium heat and cook the ground beef until browned. Add the onion and garlic and cook until fragrant. Stir in the tomato sauce, cover, and simmer for about 10 minutes. Season with salt and pepper to taste.
Arrange the tofu slices in a single layer in a baking dish. Spread the meat sauce evenly over the tofu, then sprinkle with cheese.
Bake for 15–20 minutes, until heated through and the cheese is melted. Serve immediately.