Your code is obviously implementing a similar function, but not for .html files. The test-strings and substitutions in the internal-rewrite rule you posted are for .php files, not for .html...
These two rules were also incorrectly-ordered, which could have resulted in "exposing" your \.html filepaths to search engines and their subsequent appearance in search results.
I am discarding your second rule and replacing it with a new one, now shown as the first rule below. Your original second rule was intended to do something which you explicitly said that you do not want to do -- Although non-optimally coded, it was intended to
remove trailing slashes from extensionless URLs.
There is also an exploitable security problem with your code which I will show corrected, but without further comment.
RewriteEngine on
RewriteBase /
#
# Externally redirect to remove ".html" and add a trailing
# slash to URLs directly-requested by HTTP clients
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/?#\ ]+/)*[^./?#\ ]+\.html([?#][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.html$ http://www.example.com/$1/ [R=301,L]
#
# Internally rewrite requested URLs ending with a slash to the same-named .html
# files if those .html files exist and no directories of the same name exist.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(([^/]+/)*[^./]+)/$ /$1\.html [L]
Now be very careful... be very sure that all old links to 'real' .html pages on your site have been corrected to link to page-name-only-with-trailing-slash URLs before you deploy the first rule above.
In other words, all of the links on your site must specify the correct URLs that you wish to appear in search results. Leaving the links un-corrected and relying on the redirect invoked by the first rule would slow down your visitors' experience, make a mess of your log files and 'stats' reports, show as errors in Google Webmaster Tools, and result in your site being considered to be of "lower technical quality" by search engines.
If it isn't clear, using mod_rewrite involves far more that "just a little code to change my URLs." If you are not able to perfectly understand all the code and all of the search- and quality-related issues described above, I suggest that you do not use mod_rewrite until you can. One syntax error, incorrect or incomplete design requirement, or tiny typo in this code can either take down your server instantly, or worse, it can slowly and quietly ruin your search engine rankings over time and put you out of business...
The resources cited in our Apache Forum Charter may be helpful in this regard.
Jim