Several international airlines run official stopover programs that let you extend a layover at their hub city for several days, sometimes at no extra flight cost, as a way to encourage travelers to explore their home country or region. Turkish Airlines, Icelandair, and several Middle Eastern and Asian carriers are well known for these programs, though details and included perks vary by airline and season.
Even without a formal stopover program, most airlines allow a self-arranged long layover simply by booking two one-way tickets or a multi-city itinerary instead of a single connecting round trip — the total cost is sometimes similar to a direct round-trip fare, especially if the layover city has strong route connections.
The main trade-off is convenience versus a formal itinerary: a self-arranged stopover means handling your own transit visa requirements (if any), luggage arrangements, and separate hotel booking in the layover city, since it's not automatically packaged the way an airline's official stopover program is.
