<PAGE>

                                                                    Exhibit 10.1

                          SECOND AMENDMENT TO AMENDED
                         AND RESTATED CREDIT AGREEMENT


     THIS SECOND AMENDMENT TO AMENDED AND RESTATED CREDIT AGREEMENT (this

"Amendment") is dated as of April 27, 2000 by and among TREX COMPANY, LLC, a
----------
Delaware limited liability company ("Borrower"), TREX COMPANY, INC., a Delaware
                                     --------
corporation ("Guarantor") and FIRST UNION NATIONAL BANK, a national banking
              ---------
association ("Bank").
              ----

                                R E C I T A L S

     A.  Borrower, Guarantor and Bank are parties to that certain Amended and
Restated Credit Agreement dated as of August 3, 1999, as amended by that certain
First Amendment to Amended and Restated Credit Agreement dated as of
December 15, 1999 (the "Credit Agreement").
                        ----------------

     B.  Borrower, Guarantor and Bank have agreed to extend the Revolving Credit
Period and the Term Loan Period.

                               A G R E E M E N T

     NOW THEREFORE, in consideration of the mutual covenants herein and for Ten
Dollars and other good and valuable consideration, the receipt and adequacy of
which are hereby acknowledged, the parties hereto hereby agree as follows:

     1.  Incorporation of Recitals.  The Recitals set forth above are
         -------------------------
incorporated herein by this reference as if fully set forth in the text of this
Amendment.

     2.  Definitions.  Capitalized terms used in this Amendment and not
         -----------
otherwise defined herein shall have the meanings set forth in the Credit
Agreement.

     3.  Amendment.
         ---------

         a.    The definition of "Term Loan Period" in the Definitions Appendix
     to the Credit Agreement is hereby deleted in its entirety and the following
     new definition is substituted therefor:

               "Term Loan Period" means the period from and including the
               Closing Date to but not including June 30, 2001.

         b.    The definition of "Termination Date" in the Definitions Appendix
     to the Credit Agreement is hereby deleted in its entirety and the following
     new definition is substituted therefor:
<PAGE>

               "Termination Date" means June 30, 2003, as said date may be
               extended pursuant to Section 2.07(b).

         c.    Section 2.07(b)(i) of the Credit Agreement is hereby deleted in
      its entirety and the following new Section 2.07(b)(i) is substituted
      therefor:

               (i) The Bank my elect, by notice to the Borrower not less than 15
               days and not more than 45 days prior to June 30, 2003 or the
               first anniversary of an Extension Date (as applicable, an
               "Anniversary Date"), to extend the Revolving Credit Period until
               the second anniversary of such Anniversary Date (each of the
               first and subsequent Anniversary Dates on which the Revolving
               Credit Period is extended hereunder being referred to herein as
               an "Extension Date").  Failure by the Bank to notify the Borrower
               of such election within the above time period shall be deemed to
               constitute an election by the Bank not to extend the Revolving
               Credit Period.

         d.    Section 2.08(c) of the Credit Agreement is hereby deleted in its
      entirety and the following new Section 2.08(c) is substituted therefor:

               (c) Term Loans.  The unpaid principal balance of the Term Loans
                   ----------
               on June 30, 2001 shall be payable in consecutive monthly payments
               on the first day of each month, beginning August 1, 2001, equal
               to the quotient of the amount of such unpaid principal balance on
               June 30, 2001 divided by 84; provided, however, that the entire
               unpaid principal balance of the Term Loans and all accrued
               interest thereon shall be due and payable in full on July 1,
               2008.

     4.  Representations and Warranties.  Each of Borrower and Guarantor hereby
         ------------------------------
confirms to Bank that all representations and warranties of Borrower and
Guarantor contained in the Credit Agreement are true and correct as if made on
the date hereof.

     5.  Full Force and Effect.  Except as specifically set forth herein, all
         ---------------------
terms and conditions of the Credit Agreement and the other Loan Documents shall
remain unchanged and in full force and effect.

     6.  Binding Effect.  Each of Borrower and Guarantor hereby reaffirms its
         --------------
covenant and agreement to perform, comply with and be bound by each and every
one of the terms and provisions of the Credit Agreement, as modified by this
Amendment.

     7.  Acknowledgment; No Novation.  Borrower, Guarantor and Bank agree that
         ---------------------------
this Amendment shall not constitute a novation of the indebtedness evidenced by
the Term Note or any of the other Obligations.

                                       2
<PAGE>

     8.  Successors and Assigns.  This Amendment shall be binding upon and shall
         ----------------------
inure to the benefit of the parties hereto and their respective heirs,
executors, administrators, personal representatives, successors and assigns.

     9.  Severability.  In case any one or more of the provisions contained in
         ------------
this Amendment shall be invalid, illegal or unenforceable, the validity and
enforceability of the remaining provisions contained herein shall not in any way
be affected or impaired thereby.

     10.  Counterparts.  This Amendment may be executed by the parties hereto in
          ------------
two counterparts, each of which shall be deemed an original and both of which
shall constitute together but one and the same agreement.

     The undersigned have caused this Amendment to be executed in the names and
under the seals of the undersigned, with the intent that this be a sealed
instrument.

                              BORROWER:

                              TREX COMPANY, LLC, a Delaware limited liability
                              company


                                 /s/ Anthony J. Cavanna
                              By:_______________________________(SEAL)
                                 Anthony J. Cavanna
                                 Chief Executive Officer


                              GUARANTOR:

                              TREX COMPANY, INC., a Delaware corporation


                                 /s/ Anthony J. Cavanna
                              By:________________________________(SEAL)
                                 Anthony J. Cavanna
                                 Chief Financial Officer


                              BANK:

                              FIRST UNION NATIONAL BANK, a national banking
                              association


                                 /s/ B. Scott Arthur
                              By:________________________________(SEAL)
                                 B. Scott Arthur
                                 Vice President

                                       3