Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 39637)
+++ src/wp-includes/formatting.php	(working copy)
@@ -474,6 +474,10 @@
 	// Add a double line break below block-level closing tags.
 	$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);

+	// Treat <div> as special and put a new line below opening tags and above closing tags
+	$pee = preg_replace('!(<div>)!', "$1\n", $pee);
+	$pee = preg_replace('!(</div>)!', "\n$1", $pee);
+
 	// Standardize newline characters to "\n".
 	$pee = str_replace(array("\r\n", "\r"), "\n", $pee);

@@ -523,6 +530,10 @@
 	// Under certain strange conditions it could create a P of entirely whitespace.
 	$pee = preg_replace('|<p>\s*</p>|', '', $pee);

+	// Remove the space we added to the <div> tag
+	$pee = preg_replace("!(<div>)[/\n]+!", "$1", $pee);
+	$pee = preg_replace("![/\n]+(</div>)!", "$1", $pee);
+
 	// Add a closing <p> inside <div>, <address>, or <form> tag if missing.
 	$pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);

Index: tests/phpunit/tests/formatting/Autop.php
===================================================================
--- tests/phpunit/tests/formatting/Autop.php	(revision 39637)
+++ tests/phpunit/tests/formatting/Autop.php	(working copy)
@@ -534,4 +532,14 @@

 		$this->assertEquals( $expected, trim( wpautop( $content ) ) );
 	}
+
+	/**
+	 * @ticket 37672
+	 */
+	function test_that_div_content_is_correctly_peed() {
+		$content = "<div>\nThis is a paragraph.\n\nThis is another paragraph.\n</div>";
+		$expected = "<div>\n<p>This is a paragraph.</p>\n<p>This is another paragraph.</p>\n</div>";
+
+		$this->assertEquals( $expected, trim( wpautop( $content ) ) );
+	}
 }
