A few options.
(a) Don't worry about it (the Laserlight solution :p ).
(b) Spend lots of time mucking about in your PHP code adding newlines and spaces trying to make the resulting HTML source look pretty.
(c) Use some sort of templating system (existing or "roll your own") that keeps the HTML in a separate file that you can format just the way you like.
(d) Use output buffering or otherwise save all output to a string, then at the end of the script output the entire page after piping it through the tidy extension using the "beautify" option. (This will add some processing time which might not be desirable, thus I'd probably vote for (c).)
PS: I forgot option (e) of putting all of your output data into XML via [man]SimpleXML[/man] functions, then output it as XHTML via the [man]XSL[/man] extension.