In other words, what are the most-used techniques to sanitize input and/or output nowadays? What do people in industrial (or even just personal-use) websites use to combat the problem?
If you are developing in .NET one of the most effective ways to avoid XSS is to use the Microsoft AntiXSS Library. It's a very effective way to sanitize your input.
In JSTL/JSP the best way to protect against XSS is to use the c:out tag without setting the default escapeXml parameter equal to false.
<c:out value="${somePossiblyDangerousVar}"/>
There are only two major areas in your code which need to be addressed properly to avoid xss issues.
before using any user input value in queries, use the database helper functions like mysql_escape_string over the data and then use it in query. It will gurantee xss safety.
before displaying user input values back into form input fields, pass them through htmlspecialchars or htmlentities. This will convert all xss prone values into characters that the browser can display without being compromised.
Once you have done the above, you are more than 95% safe from xss attacks. Then you can go on and learn advanced techniques from security websites and apply additional security on your site.
What most frameworks do is that they discourage you to directly write html form code or do queries in string form, so that using the framework helper functions your code remains clean, while any serious problem can be addressed quickly by just updating one or two lines of code in the framework. You can simply write a little library of your own with common functions and reuse them in all your projects.
A client's company had a security audit for its website, stripping these tags from user input prevented XSS tests from red flagging.
array('<','>',"'",'(',')','\\','"','-','script'); // edit: Limited use, pls disregard.
Added: Pádraic Brady has an article about this just 2 days ago, HTML Sanitisation: The Devil's In The Details (And The Vulnerabilities)