This study pursues the operational improvement of urban transportation services. Non-foreseen events lead to the occurrence of delays, which are further propagated during the daily operations of bus services. This paper applies an optimization model to obtain robust schedules of bus lines. The model builds a new schedule which minimizes delays and anticipations from a set of observations. The decision variables are the slack time to be allocated at each segment of two subsequent stops. The solutions obtained are assessed with two robustness measures: price of robustness (i.e. the deviations from schedule) and the percentage of absorbed delays. The results obtained in a real-world case study (a bus line operating in Porto) are promising.