PSR-2 is a coding style guide that extends PSR-1 by providing additional standards for formatting PHP code. It aims to have a single, shared style guide so code is uniformly formatted. Some key standards in PSR-2 include using 4 spaces for indentation instead of tabs, omitting the closing PHP tag, and limiting line lengths to 80 characters. PHP Mess Detector (PHPMD) is a tool that analyzes PHP source code and detects potential problems based on predefined rules related to bugs, unused code, complexity, and naming conventions.