<PAGE>

                                                                    EXHIBIT 10.4

                         PACIFIC GATEWAY EXCHANGE, INC.
                        RESTRICTED STOCK AWARD AGREEMENT

     THIS AGREEMENT, dated as of the 21st day of July, 1998 (the "Award Date")
and entered into by and between Pacific Gateway Exchange, Inc. (the "Company")
and Thomas Murphy (the "Employee"),

                                WITNESSETH THAT:
                                ---------------

     WHEREAS, the Company maintains the Pacific Gateway Exchange, Inc. 1997
Long-Term Incentive Plan (the "Plan");

     WHEREAS, the Compensation Committee has awarded the Employee shares of
Restricted Stock under the Plan;

     WHEREAS, the Employee and the Company entered into an employment agreement
dated July 21, 1998 (the employment agreement, without regard to amendments
after such date, is referred to as the "Employment Agreement");

     NOW, THEREFORE, IT IS AGREED between the Company and the Employee as
follows:

     1.   Restricted Stock.  Subject to the terms of this Agreement, the Company
          ----------------
hereby awards the Employee 15,000 shares of Restricted Stock under the Plan.

     2.   Restrictions on Stock.  During the Restricted Period (as defined in
          ---------------------
paragraph 4) with respect to any shares of Restricted Stock:

     (a)  the shares of Restricted Stock may not be sold, assigned, transferred,
          pledged or otherwise encumbered;

     (b)  the certificate representing such shares of Restricted Stock shall be
          registered in the name of the Employee and shall be deposited with the
          Company, together with a stock power (in such form as the Company may
          determine); and

     (c)  the Employee shall be treated as a shareholder with respect to the
          Restricted Stock, including the right to vote such Restricted Stock
          and all dividend rights associated with such Restricted Stock.

     3.   Transfers at Termination of Restricted Period.  Unless forfeited
          ---------------------------------------------
earlier under paragraph 5, at the end of the Restricted Period with respect to
any shares of Restricted Stock,

<PAGE>

the certificate representing such Stock shall be transferred to the Employee (or
the Employee's legal representative or heir) free of all restrictions.

     4.   Restricted Period.  The "Restricted Period" with respect to any shares
          -----------------
of Restricted Stock shall be the period commencing on the Award Date and ending
on the date the Participant is vested in the shares.  The Employee shall vest in
the Restricted Stock at the rate of 20% per year until the earlier of his
termination of employment with the Company or the fifth anniversary of the Award
Date.

     In the event of the death or total disability of the Employee while
employed by the Company, in the event of the Employee's termination by the
Company for reasons other than Cause (as that term is defined in the Employment
Agreement) or in the event that the Employee terminates his employment with the
Company for Good Reason (as that term is defined in the Employment Agreement),
the Employee shall become 100% vested in the Restricted Stock as of such date.

     In addition, in the event that the Company chooses not to extend the
Employment Period (as defined in the Employment Agreement) beyond the third
anniversary of the Effective Date the Employee shall become fully vested in an
additional 3,000 shares of Restricted Stock, but only to the extent that the
employee is not 100% vested in all the shares of Restricted stock granted under
this Agreement.

     5.   Forfeiture of Restricted Stock.  Except as provided otherwise in
          ------------------------------
paragraph 4 above, if the Employee's employment with the Company and Related
Companies terminates for any reason prior to the end of the Restricted Period
with respect to any shares of Restricted Stock, such shares of Restricted Stock
shall be forfeited and the Employee shall have no further rights with respect to
such shares.

     6.   Withholding.  This Award is subject to withholding of all applicable
          -----------
taxes.

     7.   Change in Control.  Ten days prior to the occurrence of a Change in
          -----------------
Control (as that term is defined in the Employment Agreement), the Employee
shall become vested in all outstanding shares of Restricted Stock.

     8.   Agreement Not Contract of Employment.  This Agreement does not
          ------------------------------------
constitute a contract of employment, and does not give the Employee the right to
be retained in the employ of the Company or an affiliate or the right to
continue as a director of the Company.

     9.  Definitions.  Except where the context clearly implies or indicates the
         -----------
contrary, a word, term, or phrase used in the Plan is similarly used in this
Agreement.

                                       2
<PAGE>

     10.  Administration.  The authority to manage and control the operation and
          --------------
administration of the Plan and this Agreement shall be vested in the Committee
designated under the Plan, and such Committee shall have all the powers with
respect to this Agreement as it has with respect to the Plan.  Any
interpretation of the Agreement by the Committee and any decision made by it
with respect to the Agreement is final and binding on all persons.

     11.  Plan Governs.  The terms of this Agreement shall be subject to the
          ------------
terms of the Plan, a copy of which may be obtained by the Employee from the
office of the Secretary of the Company.

                                       3
<PAGE>

     IN WITNESS WHEREOF, the Employee has hereunto set his hand and the Company
has caused these presents to be executed in its name and on its behalf, all as
of the date first above written.

                              /s/ Thomas J. Murphy
                              ______________________________
                              Employee


                              PACIFIC GATEWAY EXCHANGE, INC.


                              By /s/ Howard A. Neckowitz
                                 ---------------------------
                              Its President and CEO
                                  --------------------------

                                       4