Advanced Micro Devices Inc. on Thursday reported a second consecutive quarter of higher sales, fueled by customized processors for videogame makers and demand for its latest graphics chips.

But the company saw its loss widen as it booked a $340 million charge tied to the most recent changes to its agreement with the company that manufactures most of the chips it designs. AMD also issued revenue guidance for the current quarter that was lower than analysts expected.

AMD’s...