Bring sugar, milk, margarine, and cocoa powder to a boil in a large saucepan for 1 1/2 minutes. Remove from heat and stir in oats, peanut butter, and vanilla extract until dough is evenly mixed.
Drop tablespoonfuls of dough on prepared baking dish and let rest until cooled and set, about 50 minutes.