Heat 1/4 cup olive oil in a large saute pan over medium heat. Add the onion and garlic and cook, stirring occasionally, until tender, about 5 minutes. Remove from the heat, add the basil leaves and red pepper flakes, and stir well.
If using plum tomatoes, cut them lengthwise in half. Toss the tomatoes with the sugar and salt.
Place the tomatoes cut side down in a roasting pan that will hold them in a single layer. (If you don't have a pan large enough, use an additional roasting pan and more olive oil.) Spoon the onion mixture over the potatoes. Add enough olive oil to come halfway up the tomatoes, about 1/2 cup.
Roast until the tomatoes are tender and falling apart, about 3 hours (about 1 hour for cherry tomatoes). Stir once, gently, during the roasting. Let cool; then refrigerate, covered, in their oil.
Recipe courtesy of In the Hands of a Chef (Morrow, 2002) by Jody Adams and Ken Rivard