IMO, The best way is typically to store the HTML separately in a template file. This is a file that typically contains HTML with some fields that need to get filled in. You can then use some templating framework to safely fill in the fields in the html document as needed.
Smarty is one popular framework, here's an example how that works (taken from Smarty's crash course).
Template File
<html>
<head>
<title>User Info</title>
</head>
<body>
User Information:<p>
Name: {$name}<br>
Address: {$address}<br>
</body>
</html>
Php code that plugs name & address into template file:
include('Smarty.class.php');
// create object
$smarty = new Smarty;
// assign some content. This would typically come from
// a database or other source, but we'll use static
// values for the purpose of this example.
$smarty->assign('name', 'george smith');
$smarty->assign('address', '45th & Harris');
// display it
$smarty->display('index.tpl');
Aside from Smarty there's dozens of reasonable choices for templating frameworks to fit your tastes. Some are simple, many have some rather sophisticated features.