Oh, a silly misstake on my part. The reason is that nl2br replaces '\n' with '<br />\n' (and . doesn't match line breaks)
Last time is the charm π
$text = "First line\nSecond\n\nThird\nFourth\nFifth\n\n\nSixth\n";
$pattern = '/^(.+(<br \/>\n)+){5}/iU';
$ad = "This is an ad!<br />";
echo preg_replace($pattern, '\\0'.$ad, preg_replace('/^.*(?=<br \/>)/iU', '<strong>\\0</strong>', nl2br($text)));
That is, just add '\n' to the subpattern right after <br \/>
Or to put the add after all the 3 '\n':
$pattern = '/^(.+(<br \/>\n)+){5}(?!<br \/>)/iU';
Well, I do hope I finally nailed it.