Cut each tomato into quarters and place them on a wide, shallow oven pan. Sprinkle with the sugar, salt and pepper. Drizzle with the oil and lemon juice. Peel the garlic cloves and distribute them on the tomatoes. Add the thyme and rosemary sprigs.
Bake at the centre of the oven at 75 °C for 12 hours. Remove the dry herbs. Put the tomatoes and garlic cloves in a glass jar. Cover with oil.
Store in the refrigerator.