The best advice is … avoid long titles! If you must write a long title, you will have to choose the breakpoints yourself. There are two places you may need to break the title: at the beginning of the chapter, section or subsection, and in the table of contents. You specify these break points separately, using \titlebreak and \tocbreak, respectively. For example, the title of this section was typed like this:

\section{Sometimes you need a long \tocbreak title\titlebreak that must be set on two lines}{Long lines}{}

Note that any section title that appears in the header on an odd numbered page will appear as a single line, so you will need to use the optional second parameter to \section to provide a shorter title.