The sender and gauge must be grounded to the same source to operate correctly.
The sender's ground path is its mounting threads. Ensure that what the sender is threaded into is grounded to the same source as the gauge.
Use Teflon paste on the sender threads to secure the seal and maintain a secure ground connection. Teflon tape will NOT assist the ground connection.