Make \section unaffected by \parfillskip

The section title is typeset by \@sect, which happily encloses the relevant part in a group. At the end it adds \@@par, which is the primitive \par.

Thus we can safely patch \@sect (for numbered sections) and \@ssect (for unnumbered sections):

\documentclass{article}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@sect}{\begingroup}{\begingroup\parfillskip=0pt plus 1fil\relax}{}{}
\patchcmd{\@ssect}{\begingroup}{\begingroup\parfillskip=0pt plus 1fil\relax}{}{}
\makeatother

\usepackage{lipsum}
\begin{document}
\section{This is a section title}
\lipsum[1]

% Fill the last line of paragraphs for minimum 25%
\parfillskip 0pt plus 0.75\textwidth
\section{This is a section title}
\lipsum[1]
\end{document}

enter image description here